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