ID: 33709 Updated by: [EMAIL PROTECTED] Reported By: jjohnson at salesteamautomation dot com -Status: Open +Status: Bogus Bug Type: Mail related Operating System: Windows XP PHP Version: 4.4.0 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Works just fine here. Ask somewhere else what's wrong with your "HTML". Previous Comments: ------------------------------------------------------------------------ [2005-07-15 01:34:42] jjohnson at salesteamautomation dot com This is also a problem with version 4.4.0. ------------------------------------------------------------------------ [2005-07-15 01:00:47] jjohnson at salesteamautomation dot com Just a note on the above comment. str_replace is what causes corrupted emails. The content looks fine on the sender end, but the receiver end has problems. ------------------------------------------------------------------------ [2005-07-15 00:58:58] jjohnson at salesteamautomation dot com Here's the shortest script I can create to replicate the bug. The code is not that long, but it seems to be dependent on the data. I shortened the data as much as I could. $breaks = ' <html><head></head><body> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt"> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt"> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> </body></html> '; $works = ' <html><head></head><body> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt"> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt"> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> </body></html> '; $breaks = str_replace("\n",'',$breaks); $header = "MIME-Version: 1.0\nContent-Type: text/html; charset=iso-8859-1\n"; $result = mail("[EMAIL PROTECTED]", 'breaks', $breaks, $header, ''); $result = mail("[EMAIL PROTECTED]", 'works', $works, $header, ''); ------------------------------------------------------------------------ [2005-07-14 23:59:10] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. Please provide a *short* and *readable* reproduce script. Thanks. ------------------------------------------------------------------------ [2005-07-14 23:51:36] jjohnson at salesteamautomation dot com Description: ------------ We're having a problem with mail and str_replace. If we use str_replace on certain emails before sending them, we get extra characters in the email that is sent. Right before sending, the email looks fine. When it is received, however, it has extra characters. If str_replace is not used, the received email does not have extra characters. Reproduce code: --------------- $content_template = '<html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html>'; $content = "· Web only - $1,100 per year ". "· Phone only - $1,300 per year ". "· Both - $1,500 per year ". "*There is a one time set-up fee of $499 which we will waive with a three year agreement. "; class EmailTest{ function EmailTest($email_from, $email_to, $subject, $content_template, $content){ $this->email_from = $email_from; $this->email_to = $email_to; $this->subject = $subject; $this->content = $content; $this->content_template = $content_template; } } $email =& new EmailTest( "[EMAIL PROTECTED]", "[EMAIL PROTECTED]", "SilentWhistle Follow-up", $content_template, $content); $email->content_template = str_replace("\n",'',$email->content_template); $email->content = str_replace('', '', $email->content_template); $email->content = $email->content_template; $header = "MIME-Version: 1.0\nContent-Type: text/html; charset=iso-8859-1\n"; $result = mail($email->email_to, $email->subject, $email->content, $header, ''); Expected result: ---------------- This is the expected email: · Web only - $1,100 per year · Phone only - $1,300 per year · Both - $1,500 per year *There is a one time set-up fee of $499 which we will waive with a three year agreement. This is the html from the expected email: <html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html> Actual result: -------------- This is the received email: · Web only - $1,100 per year · ; Phone only - $1,300 per year · Both - $1,500 per year *There is a one time set-up fee of $499 which we will waive with a three year agreement. This is the html from the received email: <html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt ">  ; </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FO NT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33709&edit=1