Fixed sending MDN messages. According RFC2298:
[squirrelmail.git] / class / deliver / Deliver_SendMail.class.php
1 <?php
2 /**
3 * Deliver_SendMail.class.php
4 *
5 * Copyright (c) 1999-2004 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * Delivery backend for the Deliver class.
9 *
10 * $Id$
11 * @package squirrelmail
12 */
13
14 /** This of course depends upon Deliver */
15 require_once(SM_PATH . 'class/deliver/Deliver.class.php');
16
17 /**
18 * Delivers messages using the sendmail binary
19 * @package squirrelmail
20 */
21 class Deliver_SendMail extends Deliver {
22
23 function preWriteToStream(&$s) {
24 if ($s) {
25 $s = str_replace("\r\n", "\n", $s);
26 }
27 }
28
29 function initStream($message, $sendmail_path) {
30 $rfc822_header = $message->rfc822_header;
31 $from = $rfc822_header->from[0];
32 $envelopefrom = trim($from->mailbox.'@'.$from->host);
33 $envelopefrom = str_replace(array("\0","\n"),array('',''),$envelopefrom);
34 if (strstr($sendmail_path, "qmail-inject")) {
35 $stream = popen (escapeshellcmd("$sendmail_path -i -f$envelopefrom"), "w");
36 } else {
37 $stream = popen (escapeshellcmd("$sendmail_path -i -t -f$envelopefrom"), "w");
38 }
39 return $stream;
40 }
41
42 function finalizeStream($stream) {
43 pclose($stream);
44 return true;
45 }
46
47 function getBcc() {
48 return true;
49 }
50
51 }
52 ?>