Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-25-2006, 02:09 PM html email problem
gjr
Novice Talker

Posts: 5
Name: G Russell
Trades: 0
I can physically send email but the process is dropping off 2 characters each time an =" is encountered.

e.g. Trying to send

<html><body><div align="center"><center><table border="0 width="10%" ............etc................

ends up as

<html><body><div align=enter"><center><table border=" width=0%" ............etc................

Has anyone any ideas please?
gjr is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-25-2006, 03:37 PM Re: html email problem
Extreme Talker

Posts: 170
Name: XpIndia.Com
Trades: 0
Can you send a http link pl. Lemme see ....
XpIndia.Com is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 03:54 PM Re: html email problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
guessing that the HTML code is in strings

So, escape all the quote marks. Like so;
HTML Code:
<html><body><div align=\"center\"><center><table border=\"0\" width=\"10%\" ............etc................
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-25-2006, 04:18 PM Re: html email problem
gjr
Novice Talker

Posts: 5
Name: G Russell
Trades: 0
Yes the code is in quotes:

PHP Code:
$builtmessage '<div align=\"center\"><center>' ;
$builtmessage .= '<table border=\"0\" width=\"90%\" style=\"font-family: Tahoma; font-size: 10pt\">' ;
$builtmessage .= '<tr><td width="100%">Dear <font color="blue">' .
$builtmessage .= $ename 
when I add the \ character as suggested the outpit becomes:

HTML Code:
<html><body><div align=center\"><center><table border=0\" width=90%\" style=font-family: Tahoma; font-size: 10pt\">Anybody<tr><td width=00%">Dear <font color=lue"><div align=center\"><center><table border=0\" width=90%\" style=font-family: Tahoma; font-size: 10pt\">Anybody</font></td></tr>
The two characters =" are still lost

Anybody is the value of $ename and also appears (duplicated) before the Dear Anybody where it shouild be)
gjr is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 06:05 PM Re: html email problem
gjr
Novice Talker

Posts: 5
Name: G Russell
Trades: 0
On further testing (previous missing 2 characters was viewing source of received email in Outlook), I have dumped the output using a PHP echo command within the create program.

The text output seems to have the correct content but still missing on received email ($text is my added detail to basic email headers)

PHP Code:
$this->textheader .= 'Content-Type: multipart/alternative; boundary="'.$this->textboundary.'"'."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary."\r\n";
$this->textheader .= 'Content-Type: text/plain; charset="'.$this->charset.'"'."\r\n";
$this->textheader .= 'Content-Transfer-Encoding: quoted-printable'."\r\n\r\n";
$this->textheader .= strip_tags($text)."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary."\r\n";
$this->textheader .= 'Content-Type: text/html; charset="'.$this->charset.'"'."\r\n";
$this->textheader .= 'Content-Transfer-Encoding: quoted-printable'."\r\n\r\n";
$this->textheader .= '<html><body>'.$text.'</body></html>'."\r\n\r\n";
$this->textheader .= '--'.$this->textboundary.'--'."\r\n\r\n";
echo(
$this->textheader) ; 
echo'd output

HTML Code:
 
Content-Type: multipart/alternative; boundary="1151265726449eebbe81967"
--1151265726449eebbe81967
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear anybody2&nbsp;TopicTraining - GeneralCategoryIndividual - ProfessionalYour email Address XX@XX.COM Your Name anybody2 Your Messagemessage2&nbsp;Thank you for the interest shown in the recoverquick/prosport programs.Your message will be passed to the appropriate department and processed as soon as possible.If you have any further questions in the mean time please do not hesitate to contact&nbsp;XXX@XX.COM&nbsp;RegardsThe Prosport Team&nbsp;&nbsp;
--1151265726449eebbe81967
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
<html><body><div align="center"><center><table border="0" width="90%" style="font-family: Tahoma; font-size: 10pt"><tr><td width="100%">Dear <font color="blue">anybody2</font></td></tr></table></center></div><p>&nbsp;</p><div align="center"><center><table border="1" width="80%" style="font-family: Tahoma; font-size: 10pt" bordercolor="#000000" bordercolordark="#000000" cellspacing="0" cellpadding="5"><tr><td width="50%" valign="top">Topic</td><td width="50%" style="color: blue"><font color="#0000FF">Training - General</font></td></tr><tr><td width="50%" valign="top">Category</td><td width="50%" style="color: #0000FF"><font color="#0000FF">Individual - Professional</font></td></tr><tr><td width="50%" valign="top">Your email Address</td><td width="50%" style="color: #0000FF"><font color="#0000FF">grussell@f2s.com</font></td></tr><tr><td width="50%" valign="top">Name</td><td width="50%" style="color: #0000FF"><font color="#0000FF">anybody2</font></td></tr><tr><td width="50%" valign="top">Your Message</td><td width="50%" style="color: #0000FF"><font color="#0000FF">message2</font></td></tr></table></center></div><p>&nbsp;</p><div align="center"><center><table border="0" width="90%" style="font-family: Tahoma; font-size: 10pt"><tr><td width="100%">Thank you for the interest shown in the recoverquick/prosport programs.<p>Your message will be passed to the appropriate department and processed as soon as possible.</p></center><p align="left">If you have any further questions in the mean time please do not hesitate to contact<br>&nbsp;<a href="mailto:XXX.XX.COM">XXX.XX.COM </a></p></center><p align="left">Regards</p><p align="left">The Prosport Team<br><img border="0" src=" http://www.XXX.com/images/psport1.gif " alt="The Future of Training" width="308" height="32"><center><p>&nbsp;</td></tr></table></div><p>&nbsp;</p></body></html>
--1151265726449eebbe81967--
gjr is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 06:37 PM Re: html email problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Put some line breaks into the generated text. Mail servers and clients will insert a carriage return into long lines of text, normally at 76 characters.

That may be part of the problem.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-26-2006, 05:01 AM Re: html email problem
gjr
Novice Talker

Posts: 5
Name: G Russell
Trades: 0
I changed the text to a minimum length

PHP Code:
$builtmessage '<div align="center"><center>' ;
$builtmessage .= '<p>&nbsp;</div><p>&nbsp;</p>' 
and the resultant line was still in error

HTML Code:
 
<html><body><div align=enter"><center><p>&nbsp;</div><p>&nbsp;</p></body></html>
 
gjr is offline
Reply With Quote
View Public Profile
 
Old 06-26-2006, 05:59 AM Re: html email problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you still don't have any line breaks though. And I mean line breaks as in newline characters "\n".

does the message string go through any other process before sending ?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-26-2006, 06:19 AM Re: html email problem
gjr
Novice Talker

Posts: 5
Name: G Russell
Trades: 0
The /n may be red herring, although I take the point it may be safer to insert in case a mail server doesn't like long lines.

I inserted the following code to convert the text line
Even with the very long text and no /n's

it worked

It is nice to have a workaround, but I am always happier if I know why a problem occurs in case it is masking a deeper problem.

Therefore if any definitive reason is found by anybody, I would appreciate knowing.

Thanks for your time and efforts.
PHP Code:
$quote '="';
$quoterep '="\"' ;
$text ereg_replace($quote$quoterep$text ) ; 
gjr is offline
Reply With Quote
View Public Profile
 
Old 07-09-2006, 04:04 AM Re: html email problem
Junior Talker

Posts: 1
Name: Aaron Heck
Trades: 0
After beating my head against this similar problem for a while today, and googling it to death without success, I believe I have come up with a proper fix for it (not to take away from your fix, gjr, as it gave me sufficient inspiration to dig deeper).

Symptom:
HTML messages generated in PHP render fine in Thunderbird, Mac Mail and Squirrelmail but do not render properly in Outlook, Outlook Express, or Outlook Web Access.

Investigation:
Testing was done with a single IMAP mail account - accessing it using multiple email clients. This ensured that the only variable in the equation was the email client. As gjr pointed out, the issue appears to be that the MS products are dropping certain characters. In particular, any equals sign followed by a quote and another character has the quote and character dropped (ie: <a href="blah"> becomes <a href=lah">).

Solution:
Changing the message encoding type from "quoted-printable" to "base64" and tossing the HTML message through a chunk_split(base64_encode()) allows the html email to render properly in all tested mail readers.

Thanks to Leon Atkinson at Zend:
http://www.zend.com/zend/trick/html-...1&anc=0&view=1
(quote: "I used base64 encoding instead of quoted-printable because Microsoft's e-mail clients appear to have trouble with quoted-printable messages.")

Before:
PHP Code:
        if ($email_body['html']) {
            
$email_body['html'] = "--".$alternative_mime_boundary.$s_eol.
                                  
"Content-Type: text/html; charset=\"iso-8859-1\"; format=flowed" .$s_eol.
                                  
"Content-Transfer-Encoding: quoted-printable".$s_eol.$s_eol.
                                  
$email_body['html'].$s_eol.$s_eol.
                                  
"--".$alternative_mime_boundary."--".$s_eol.$s_eol;
        } 
After:
PHP Code:
        if ($email_body['html']) {
            
$email_body['html'] = "--".$alternative_mime_boundary.$s_eol.
                                  
"Content-Type: text/html; charset=\"iso-8859-1\";" .$s_eol.
                                  
"Content-Transfer-Encoding: base64".$s_eol.$s_eol.
                                  
chunk_split(base64_encode($email_body['html'])).$s_eol.$s_eol.
                                  
"--".$alternative_mime_boundary."--".$s_eol.$s_eol;
        } 
Possible Cause:
Your guess is as good as mine - probably related to =" being a "keyword" of sorts for some mime functionality.

Possible Side Effects:
I suppose on a very heavily loaded web server you would see performance degredation from the extra chunk_split and base64_encode calls. Can't see it really being an issue, though.

Hope this helps somebody else when they're googling for this.

(my search terms were "outlook html rendering problem dropped characters -vulnerability" and it didn't get my anywhere - I'm mentioning it here to help future googlers with their search for this problem/solution)

Aaron
Lupis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to html email problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33850 seconds with 12 queries