e1ee60fe |
1 | <?php |
2 | |
3 | require_once('Deliver.class.php'); |
4 | |
5 | class Deliver_SendMail extends Deliver { |
6 | |
11a01a02 |
7 | function preWriteToStream(&$s) { |
8 | if ($s) { |
9 | if ($s{0} == '.') $s = '.' . $s; |
10 | $s = str_replace("\n.","\n..",$s); |
11 | $s = str_replace("\r\n", "\n", $s); |
12 | } |
13 | } |
14 | |
15 | function initStream($message, $sendmail_path) { |
16 | $rfc822_header = $message->rfc822_header; |
17 | $from = $rfc822_header->from[0]; |
18 | $envelopefrom = $from->mailbox.'@'.$from->host; |
19 | if (strstr($sendmail_path, "qmail-inject")) { |
20 | $stream = popen (escapeshellcmd("$sendmail_path -f$envelopefrom"), "w"); |
21 | } else { |
22 | $stream = popen (escapeshellcmd("$sendmail_path -t -f$envelopefrom"), "w"); |
23 | } |
24 | } |
25 | |
26 | function finalizeStream($stream) { |
27 | pclose($stream); |
28 | } |
e1ee60fe |
29 | } |
30 | ?> |