e1ee60fe |
1 | <?php |
5b8fd093 |
2 | /** |
3 | * Deliver_SendMail.class.php |
4 | * |
5 | * Copyright (c) 1999-2002 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 | */ |
e1ee60fe |
12 | |
760c84a3 |
13 | require_once('../class/deliver/Deliver.class.php'); |
e1ee60fe |
14 | |
15 | class Deliver_SendMail extends Deliver { |
16 | |
11a01a02 |
17 | function preWriteToStream(&$s) { |
18 | if ($s) { |
19 | if ($s{0} == '.') $s = '.' . $s; |
20 | $s = str_replace("\n.","\n..",$s); |
21 | $s = str_replace("\r\n", "\n", $s); |
22 | } |
23 | } |
24 | |
25 | function initStream($message, $sendmail_path) { |
26 | $rfc822_header = $message->rfc822_header; |
27 | $from = $rfc822_header->from[0]; |
28 | $envelopefrom = $from->mailbox.'@'.$from->host; |
29 | if (strstr($sendmail_path, "qmail-inject")) { |
30 | $stream = popen (escapeshellcmd("$sendmail_path -f$envelopefrom"), "w"); |
31 | } else { |
32 | $stream = popen (escapeshellcmd("$sendmail_path -t -f$envelopefrom"), "w"); |
33 | } |
34 | } |
35 | |
36 | function finalizeStream($stream) { |
37 | pclose($stream); |
38 | } |
e1ee60fe |
39 | } |
40 | ?> |