|
Posted by Curt Zirzow on 11/02/05 02:27
On Tue, 01 Nov 2005 17:54:26 +0200, Rasim ÞEN wrote:
> Hi,
>
> This function was working until this morning, but now I couldn't send any
> email to hotmail. What is the problem, any idea?
Honestly, i would trust this function even if it proposed to mary me; see
below.
> function
> SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m
> emberid,$MemberSurname,$mtype="tbl"){
Way to many parameters to even consider
>
> $MemberId=$memberid;
> $MemberName=$ToName;
> $MemberSurname=$MemberSurname;
> $MemberEmail=$To;
> $Subject=$Subject;
> $MailBody=$Html;
cool, all the parameters are renamed.. oh wait only some of them, what to
use...
>
> $OB="----=_OuterBoundary_000";
> $IB="----=_InnerBoundery_001";
I guess we are only attaching one file.
> $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text)
> or die("neither text nor html part present.");
all i have to say.. omg
> $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");
yet more omg's
>
> $headers ="MIME-Version: 1.0\r\n";
> $headers.="From: ".$FromName." <".$From.">\n"; $headers.="To: ".$ToName."
> <".$To.">\n"; $headers.="Reply-To: ".$FromName." <".$From.">\n";
What happens when $FromName = "l33t < lame > noobie", ditto for $ToName.
> // $headers.="Reply-To: \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"; $headers .=
> "BCC:".$bcc."\n";
Setting boundary like this is makes no sense (see above.)
> //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";
I find this stuff rather amusing, according to the manual it says to use
\r\n as the line ending, but yet it starts with uses \n most of the time
>
> //plaintext section
> $Msg.="\n--".$IB."\n";
> $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n";
Are you really sending iso-8859-9 charset? (see above about above);
> $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-9\"\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";
wow, this is amazing.
>
> // 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";
No wonder why the arguments to this function are so complicated.
> //message ends
> $Msg.="\n--".$OB."--\n";
>
> if(mail($To,$Subject,$Msg,$headers)){ //1.test
What is $To, $Subject, $Msg, $headers? and once you know that what is the
actual email that is composed and sent to the destination server?
Curt.
--
http://news.zirzow.dyndns.org/
[Back to original message]
|