Login   Register  
PHP Classes
elePHPant
Icontem

Attached HTML message displaying incorrectly on iphone and gmail

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      MIME E-mail message sending  >  All threads  >  Attached HTML message displaying incorrectly on iphone and gmail  >  (Un) Subscribe thread alerts  
Subject:Attached HTML message displaying incorrectly on iphone and gmail
Summary:HTML messages displaying part identifier
Messages:8
Author:Alan Fullmer
Date:2012-09-15 01:55:49
Update:2012-09-15 10:17:56
 

  1. Attached HTML message displaying incorrectly on iphone and gmail   Reply   Report abuse  
Picture of Alan Fullmer
Alan Fullmer
2012-09-15 01:55:49
So here is my issue.

I am attempting to send an email to an individual, while attaching another message.

It seems to work in Outlook without problems, however, when I read it on Gmail it displays the part id, e.g. --7a3ac6e3ab3216a55aa8cc55f7b4f00e-- inside of the message body itself.

On iOS devices such as the iPhone, it usually gets the very end of the part id--sometimes the full part id.

I thought I have followed the examples (test_simple_html_mail_message.php) to the T, but it just doesn't seem to be working right.

--------------

$mail->CreateQuotedPrintableTextPart ( $mail->WrapText ( $this->message_body['text'] ), "", $text_part );
$mail->CreateQuotedPrintableHTMLPart ( $this->message_body['html'], "", $html_part );
$alternative_parts = array ($text_part, $html_part );
$mail->CreateAlternativeMultipart ( $alternative_parts, $alternative_part );

$mail->Send ();

---------------

I just can't seem to figure out what the issue would be. Any ideas that others have had, please share. Thanks.


  2. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Alan Fullmer
Alan Fullmer
2012-09-15 02:25:18 - In reply to message 1 from Alan Fullmer
This is from Gmail:

This is the body of what's sent to the iPhone, which is an attached message
--9eaaf0de216cfed85e8abed2d4368509--



This is the body of the the new message that attaches another message.

  3. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Alan Fullmer
Alan Fullmer
2012-09-15 02:55:10 - In reply to message 2 from Alan Fullmer
First problem solved (I think).

I had to encapsulate my message body with \r\n and that issue seems to be resolved.

Perhaps some more testing. If it does turn out to be that, it may be something to include in the class itself?

  4. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-09-15 04:31:06 - In reply to message 3 from Alan Fullmer
The class detects if the line break sequence of your OS is \n (for Linux/Unix) or \r\n (for Windows). I suspect that you are under Windows. Still the mail function should do the necessary conversions. Maybe it isn't the case.

  5. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Alan Fullmer
Alan Fullmer
2012-09-15 04:40:37 - In reply to message 4 from Manuel Lemos
Take a look at this. This is a view source to a Gmail message:

..snip..
v4</p>
<p>Thank you and talk to you later</p>
</span>--e8da39b5a054ed22e8f2f15d8140ecee--
--eb3e801f663305af58e1882f3d882fe4--
--c5fa9694ef74b66169d2cecdc0a810b6
Content-Type: multipart/related; boundary="94e8a694c944ec1e26111f51875b9443"

See how the --e8da39b5a054ed22e8f2f15d8140ecee-- is right up against the ending span tag? When I force it to \r\n the issue goes away.

I am still trying to determine where the issue lies.

  6. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-09-15 05:51:38 - In reply to message 5 from Alan Fullmer
As I mentioned, I suspect you are using Windows. In that case, there is a line break \n there which was not translated into \r\n which is required by SMTP to break lines. So I think that while you do not see the line break because Windows does not recognize it as such, it is there.

  7. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Alan Fullmer
Alan Fullmer
2012-09-15 06:00:41 - In reply to message 6 from Manuel Lemos
Well I'm not using Windows.

The server itself is a CentOS 6.x server running Zend's CE version of PHP.

Zend-server-ce-php-5.3

Well either way, I will use the workaround for now. I just had to add an extra \n at the end of the body before I set it to the CreateQuotedPrintableHTMLPart function. That gave it the extra new line so the boundary doesn't get set on the same line.

FWIW.


  8. Re: Attached HTML message displaying incorrectly on iphone and g   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-09-15 10:17:56 - In reply to message 7 from Alan Fullmer
Ah, since you said you added \r\n to the message, I thought it was a matter of line breaks.

Anyway, I just looked at the generated code and there was indeed a bug introduced in the last revision related with the need for line breaks between multipart message separators. The bug is fixed and a new version was uploaded. Just let me know if you find any other issues. Thank you for reporting.