note 59538 deleted from ref.mail by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 20:17:46 +0000 |
| Subject: | note 59538 deleted from ref.mail by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155366@lists.php.net to get a copy of this message | ||
Note Submitter: tinus
----
as to fred's posting, I had to change the code a bit:
-add a hashbang
-add "-t -i " to the sendmail call
great idea though.
#!/usr/bin/php
<?php
$tmpfile = "/tmp/" . uniqid('') . ".mail";
$fp = fopen($tmpfile,"w");
fwrite($fp,"x-wls-cc-filter: On\n");
while($line = fgets(STDIN))
{
$line = ereg_replace("^bcc:","x-wlsspam-bcc:",$line);
$line = ereg_replace("^cc:","x-wlsspam-cc:",$line);
fwrite($fp,$line);
}
fclose($fp);
$cmd = '/usr/sbin/sendmail -t -i ';
for($i = 1 ; $i < $argc; $i++)
{
$cmd .= $argv[$i];
$cmd .= ' ';
}
$cmd .= "<$tmpfile";
system($cmd);
?>