steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr resmgr.php, 1.30, 1.31
cvs at intevation.de
cvs at intevation.de
Mon Oct 11 15:05:55 CEST 2004
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv4951/kolab-resource-handlers/resmgr
Modified Files:
resmgr.php
Log Message:
use smtp to inject mail back into postfix
Index: resmgr.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/resmgr.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- resmgr.php 7 Oct 2004 12:37:54 -0000 1.30
+++ resmgr.php 11 Oct 2004 13:05:53 -0000 1.31
@@ -370,9 +370,9 @@
$requestText = preg_replace("/\r\n|\n|\r/s", "\r\n", $requestText);
}
-function checkLMTPResponse(&$lmtp, $code)
+function checkSMTPResponse(&$smtp, $code)
{
- $resp = $lmtp->getResponse();
+ $resp = $smtp->getResponse();
if ($resp[0] != $code) {
myLog($resp[1], RM_LOG_ERROR);
shutdown(1, $resp[1]);
@@ -381,48 +381,48 @@
return true;
}
-function sendLMTP($sender, $recip, &$data)
+function sendSMTP($sender, $recip, &$data)
{
- static $lmtp;
- if (!isset($lmtp)) {
- require_once 'Net/LMTP.php';
+ static $smtp;
+ if (!isset($smtp)) {
+ require_once 'Net/SMTP.php';
- $lmtp = &new Net_LMTP();
- if (!$lmtp) {
- $msg = 'Could not create LMTP object';
+ $smtp = &new Net_SMTP('localhost',10026);
+ if (!$smtp) {
+ $msg = 'Could not create SMTP object';
myLog($msg, RM_LOG_ERROR);
shutdown(1, $msg);
}
- if (PEAR::isError($error = $lmtp->connect())) {
+ if (PEAR::isError($error = $smtp->connect())) {
$msg = 'Failed to connect to LMTP: ' . $error->getMessage();
myLog($msg, RM_LOG_ERROR);
shutdown(1, $msg);
}
- checkLMTPResponse($lmtp, 250);
+ checkSMTPResponse($smtp, 250);
- if (PEAR::isError($error = $lmtp->mailFrom($sender))) {
+ if (PEAR::isError($error = $smtp->mailFrom($sender))) {
$msg = 'Failed to set sender: ' . $error->getMessage();
myLog($msg, RM_LOG_ERROR);
shutdown(1, $msg);
}
- checkLMTPResponse($lmtp, 250);
+ checkSMTPResponse($smtp, 250);
- if (PEAR::isError($error = $lmtp->rcptTo($recip))) {
+ if (PEAR::isError($error = $smtp->rcptTo($recip))) {
$msg = 'Failed to set recipient: ' . $error->getMessage();
myLog($msg, RM_LOG_ERROR);
shutdown(1, $msg);
}
- checkLMTPResponse($lmtp, 250);
+ checkSMTPResponse($smtp, 250);
- if (PEAR::isError($error = $lmtp->data($data))) {
+ if (PEAR::isError($error = $smtp->data($data))) {
$msg = 'Failed to send data: ' . $error->getMessage();
myLog($msg, RM_LOG_ERROR);
shutdown(1, $msg);
}
- checkLMTPResponse($lmtp, 250);
+ checkSMTPResponse($smtp, 250);
- $lmtp->disconnect();
+ $smtp->disconnect();
}
}
@@ -445,7 +445,7 @@
}
if ($params['group']) {
- sendLMTP($sender, $resource, $requestText);
+ sendSMTP($sender, $resource, $requestText);
shutdown(0);
} else {
myLog('No iCalendar data found in message', RM_LOG_ERROR);
@@ -950,7 +950,7 @@
shutdown(0);
} else if( $params['action'] == RM_ACT_MANUAL ) {
myLog("Passing through $method method to $resource");
- sendLMTP($sender, $resource, $requestText);
+ sendSMTP($sender, $resource, $requestText);
shutdown(0);
}
@@ -1181,7 +1181,7 @@
// Pass the message through to the group's mailbox
myLog("Passing through $method method to $resource");
-sendLMTP($sender, $resource, $requestText);
+sendSMTP($sender, $resource, $requestText);
shutdown(0);
?>
More information about the commits
mailing list