Issues

ZF-6173: Zend_Mail doesn't send HTML email correctly - shows up an as attachment, or plaintext (client dependent)

Description

This is HTML email.

Comments

http://support.microsoft.com/kb/814111

The attachment part is actually a Microsoft issue. Simple way to fix it is to remove the (not required) content-disposition:


Index: Zend/Mail.php
===================================================================
--- Zend/Mail.php   (revision 14574)
+++ Zend/Mail.php   (working copy)
@@ -326,7 +326,6 @@
         $mp = new Zend_Mime_Part($txt);
         $mp->encoding = $encoding;
         $mp->type = Zend_Mime::TYPE_TEXT;
-        $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
         $mp->charset = $charset;
 
         $this->_bodyText = $mp;
@@ -367,7 +366,6 @@
         $mp = new Zend_Mime_Part($html);
         $mp->encoding = $encoding;
         $mp->type = Zend_Mime::TYPE_HTML;
-        $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
         $mp->charset = $charset;
 
         $this->_bodyHtml = $mp;

The HTML problem in evolution seems to be related to the Exchange server, getting the mail directly from the mail account works just fine. Testing Outlook without Exchange server soon.

The Outlook problem also only occurs when used via Exchange server, the patch is in any case not neccessary. Doing further testing.

Agreed - working with Ben, we've discovered the issue is not specific to the client, but more to exchange.

The tests carried out use both evolution and outlook, sitting behind an exchange server. HTML email sent from Zend_Mail exhibits the error, but when accessing POP or IMAP mail via outlook and evolution, there are no problems.

Now to find out what Zend_Mail is doing that exchange is choking on...

The file contains headers from 4 emails.

All emails were opened in Microsoft Outlook using 2 different accounts - one IMAP, the other behind Microsoft exchange. All examples use the code presented in the initial post.

  • Sending HTML email from Zend_Mail to the account behind exchange doesn't work as intended. The html is sent as an attachment.

  • Sending HTML email from PHP's mail function to the account behind exchange works as expected.

  • Sending HTML email from Zend_mail to an IMAP account, bypassing exchange, works as intended.

  • Sending HTML email from PHP's mail function to an IMAP account, bypassing exchange, also works as intended.

So basically, in all the scenarios tried, only the scenario involving Zend_Mail and exchange doesn't work as intended. It appears the content-type and charset declarations are not present when sent from Zend_Mail to the exchange account. Without checking the code, I would assume that perhaps the content type is applied only to the content, not to the entire mail, whereas when sending using PHP's mail function, the content-type and charset are always set for the entire mail.

Whoops, just to add to the comment above, all tests were carried out with an unpatched Zend_Mail as previous testing determined that the content-disposition issue was not at fault here.

Reset the priority from "Blocker" to "Minor" since the issue does not seem to be a Zend_Mail, but an exchange problem (i also have the same problem with exchange with other mail sending libraries).

I have tested this with Outlook 2007 behind an Exchange server and it works correctly with the Inline Content Disposition.

Can we close this one?