[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] SpamAssassin forwarding mailbox [SCANNED]
- Subject: RE: [cobalt-users] SpamAssassin forwarding mailbox [SCANNED]
- From: "Phil Beynon" <phil@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri Apr 9 10:58:03 2004
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
> On 4/9/04 11:48 AM, "Phil Beynon" wrote:
>
> > If you have the original mail you should be able to read the
> headers in it
> > then forward it to the spam account whilst rebuilding it with
> the original
> > headers using PHP, the -f option on sendmail would even allow it to look
> > like it came from the sending server.
>
> Interesting, our mailhub is non web enabled :( but your saying users could
> use a form to send into the email account on the SA server? Any tips or
> locations of a simple php mailer you know off or have?
> --
> Thanks!!
> David Thurman
> List Only at Web Presence Group Net
This works just fine;
Note the last line in the function which is where you can embed the sending
servers url, it will make sendmail throw a authentication error in the
maillog log though, not really important.
It wil handle text and html emails, you capture what you want into the TEXT
& HTML variables, plus it can also send multiple attachments as external
files. I found it somewhere, have used it extensively and it works sweetly
as a remailer.
once used variables are setup you call it by;
SendMail(
"sender@xxxxxxxxxx"," senders name", //sender
"recipient@xxxxxxxxxx," recipients name", //recipient
"subject text", //subject
$TEXT,$HTML,$ATTM);
The function;
<?php
function
SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles){
$OB="----=_OuterBoundary_000";
$IB="----=_InnerBoundery_001";
$Html=$Html?$Html:preg_replace("/\n/","<br>",$Text)
or die("neither text nor html part present.");
$Text=$Text?$Text:"Sorry, but you need an html mailer to read this mail.";
$From or die("sender address missing");
$To or die("recipient address missing");
$headers ="MIME-Version: 1.0\r\n";
$headers.="From: ".$FromName." <".$From.">\n";
$headers.="To: ".$ToName." <".$To.">\n";
$headers.="Reply-To: ".$FromName." <".$From.">\n";
$headers.="X-Priority: 1\n";
$headers.="X-MSMail-Priority: High\n";
$headers.="X-Mailer: My PHP Mailer\n";
$headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n";
//Messages start with text/html alternatives in OB
$Msg ="This is a multi-part message in MIME format.\n";
$Msg.="\n--".$OB."\n";
$Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n";
//plaintext section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
$Msg.="Content-Transfer-Encoding: quoted-printable\n\n";
// plaintext goes here
$Msg.=$Text."\n\n";
// html section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n";
$Msg.="Content-Transfer-Encoding: base64\n\n";
// html goes here
$Msg.=chunk_split(base64_encode($Html))."\n\n";
// end of IB
$Msg.="\n--".$IB."--\n";
// attachments
if($AttmFiles){
foreach($AttmFiles as $AttmFile){
$patharray = explode ("/", $AttmFile);
$FileName=$patharray[count($patharray)-1];
$Msg.= "\n--".$OB."\n";
$Msg.="Content-Type: application/octetstream;\n\tname=\"".$FileName."\"\n";
$Msg.="Content-Transfer-Encoding: base64\n";
$Msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\n\n";
//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$Msg.=$FileContent;
$Msg.="\n\n";
}
}
//message ends
$Msg.="\n--".$OB."--\n";
mail($To,$Subject,$Msg,$headers,'-faddress@xxxxxxxxxx');
}
?>
Regards,
Phil
** http://www.diygear.com THE Online DIY Toolstore For DIY & Business
** Infolink Electronic Systems Ltd. http://www.infolinkelectronics.co.uk
** Professional Web Design & Cobalt Hosting Solutions
** Sun Cobalt iForce Reseller - Canon Silver Reseller
** Contact: Sales@xxxxxxxxxxxxxxxxxxxxxxxxx
** Tel / Fax 0121 458 4894 (office) 0121 441 3558 (home)