PHP mail header - only first line was used, the rest rendered as body

trex92

New Member
Been having this problem for very long and couldn't find any solution. What happen is that occasionally the email that I sent out has the header appearing in the body text. On closer examination, the first line of the header was read as header but the rest of the header are thought to be body. It only happens to a selected few recipients so I'm wondering whether it's their mail client that's unable to read the headers correctly.A copy and paste of a sample corrupted mail (it appears as plain text in the mail):\[code\]Content-Type: multipart/alternative;boundary="4ca471aa8aed6" From: XXX <[email protected]> Message-ID: <[email protected]> X-Mailer: PHP v5.2.14Date: Thu, 30 Sep 2010 12:16:58 +0100 (BST)X-Spam: [F=0.2000000000; B=0.500(0); STSI=0.500(-24); STSM=0.500(-24); CM=0.500; MH=0.500(2010093005); S=0.200(2010073001); SC=none]X-MAIL-FROM: <[email protected]>X-SOURCE-IP: [83.138.141.236]X-AnalysisOut: [v=1.0 c=1 a=x7AK10Bnz50A:10 a=BLceEmwcHowA:10 a=VqisAvswpt]X-AnalysisOut: [4FyOtI4ClGvg==:17 a=vw80RhgAwbNm-Xx5EKgA:9 a=dX3ThSBsV1pHv]X-AnalysisOut: [tqXy1oA:7 a=yEJHB1MS_eYZD3xBjjsxBp4tBv8A:4 a=QEXdDO2ut3YA:]X-AnalysisOut: [10 a=xNwWcUBMj4F1506d:21 a=jABlWf4rlI1j5d6A:21 a=MGaB5ybbA]X-AnalysisOut: [AAA:8 a=6-7fRTDBl2X58nfIeBAA:9 a=UMAsvBM9vilmjbwRO0EA:7 a=]X-AnalysisOut: [TNgMOtyArbXF74fBhVb4Pk7RMrwA:4 a=_wpYbfnAMgAA:10 a=iDrULPt]X-AnalysisOut: [N55ecZwpH:21 a=e4HzzWUux0m5Q-ha:21]--4ca471aa8aed6 Content-type: text/plain; charset=utf-8\[/code\]Mail body here onwards..The corresponding php coding of the above mail is:\[code\]$eol = "\r\n";$boundary = uniqid();$headers = 'MIME-Version: 1.0' . $eol;$headers .= 'Content-Type: multipart/alternative;boundary="' . $boundary . '"' . $eol;$headers .= "From: $firstname $lastname <$email>" .$eol;$headers .= 'Message-ID: <'.time().'[email protected]>'.$eol. 'X-Mailer: PHP v' . phpversion() . $eol;$subject = "Subject";$message = "--$boundary$eol";$message .= "Content-type: text/plain; charset=utf-8$eol$eol;$message .="Message body here";\[/code\]Notice that the first line in the header does not appear in the email. Anybody experience it before? It only happens to a few recipients, 99% of the mails are fine. For those that have this problem, they mentioned that they are fine receiving HTML mails from other sources. Also, I know one of them is using IBM lotus notes.. any issues there?Thanks!
 
Back
Top