e1ee60fe |
1 | <?php |
5b8fd093 |
2 | /** |
3 | * Deliver_SendMail.class.php |
4 | * |
76911253 |
5 | * Copyright (c) 1999-2003 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$ |
11 | */ |
e1ee60fe |
12 | |
0f85ddf9 |
13 | require_once(SM_PATH . 'class/deliver/Deliver.class.php'); |
e1ee60fe |
14 | |
15 | class Deliver_SendMail extends Deliver { |
16 | |
11a01a02 |
17 | function preWriteToStream(&$s) { |
18 | if ($s) { |
4d3b30dc |
19 | $s = str_replace("\r\n", "\n", $s); |
11a01a02 |
20 | } |
21 | } |
22 | |
23 | function initStream($message, $sendmail_path) { |
24 | $rfc822_header = $message->rfc822_header; |
25 | $from = $rfc822_header->from[0]; |
44cdf261 |
26 | $envelopefrom = trim($from->mailbox.'@'.$from->host); |
1f9c969d |
27 | $envelopefrom = str_replace(array("\0","\n"),array('',''),$envelopefrom); |
11a01a02 |
28 | if (strstr($sendmail_path, "qmail-inject")) { |
4d3b30dc |
29 | $stream = popen (escapeshellcmd("$sendmail_path -i -f$envelopefrom"), "w"); |
11a01a02 |
30 | } else { |
4d3b30dc |
31 | $stream = popen (escapeshellcmd("$sendmail_path -i -t -f$envelopefrom"), "w"); |
11a01a02 |
32 | } |
fb762331 |
33 | return $stream; |
11a01a02 |
34 | } |
35 | |
36 | function finalizeStream($stream) { |
37 | pclose($stream); |
d9f49968 |
38 | return true; |
11a01a02 |
39 | } |
93bbf72b |
40 | |
41 | function getBcc() { |
42 | return true; |
43 | } |
44 | |
e1ee60fe |
45 | } |
46 | ?> |