Sendmail backend for the deliver class
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 4 Sep 2002 22:00:19 +0000 (22:00 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 4 Sep 2002 22:00:19 +0000 (22:00 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3540 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/deliver/Deliver_SendMail.class.php

index eba2215..87e2a32 100644 (file)
@@ -4,5 +4,27 @@ require_once('Deliver.class.php');
 
 class Deliver_SendMail extends Deliver {
 
+    function preWriteToStream(&$s) {
+       if ($s) {
+          if ($s{0} == '.')   $s = '.' . $s;
+         $s = str_replace("\n.","\n..",$s);
+          $s = str_replace("\r\n", "\n", $s);
+       }
+    }
+    
+    function initStream($message, $sendmail_path) {
+        $rfc822_header = $message->rfc822_header;
+       $from = $rfc822_header->from[0];
+       $envelopefrom = $from->mailbox.'@'.$from->host;
+       if (strstr($sendmail_path, "qmail-inject")) {
+           $stream = popen (escapeshellcmd("$sendmail_path -f$envelopefrom"), "w");
+       } else {
+           $stream = popen (escapeshellcmd("$sendmail_path -t -f$envelopefrom"), "w");
+       }
+    }
+    
+    function finalizeStream($stream) {
+       pclose($stream);
+    }
 }
 ?>