Just a note here that with PHP 5.3, Mail Mime works flawlessly for me. (sidenote: I didn't download the include module and don't have PEAR but it seems to work great. I do have Phar installed and mbstring.http_output_conv_mimetypes which is new to 5.3 I believe)

However on a PHP 5.2.17 with the include module, the module does it's job however with an html-capable email client, it not only shows the html message immediately but also includes every linked image as an attached image.

I'd like to be able to not have the attachments show up at all if the email can be rendered as html. Is it possible?
cheers
-wil

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

Version: 7.x-2.13 » 7.x-2.x-dev
Component: Miscellaneous » Code
Assigned: Unassigned » pillarsdotnet
Category: support » bug
Status: Active » Needs work

Thanks for the report; I will investigate.

pillarsdotnet’s picture

Building php 5.2.17 from source now...

Need to downgrade my copy of flex....

Okay, now running php 5.2.17.

Testing....

pillarsdotnet’s picture

Status: Needs work » Postponed (maintainer needs more info)
FileSize
69.37 KB

Symptoms don't repeat on php 5.2.17 receiving via Mozilla Thunderbird. I see no image attachments.

blasthaus’s picture

Maybe it's an issue with Gmail then. I'll run a test on Litmus and report back

blasthaus’s picture

EDIT: Actually the below applies to sending attached images which do not also appear in the body (Gmail only) sorry!

For GMail, I read that in order for this not to occur, need to change several things in Mime:
1. The first Content-Type must be "Content-Type: multipart/related;"
2. The image attachments must not have "Content-Disposition: inline"

fyi: here is the Litmus test http://blasthaus.litmus.com/pub/8326852 which doesn't actually show the attachments to the messages, but I'm getting them on GMail on a Mac

pillarsdotnet’s picture

Title: Linked stylesheet images show up as attachments in some cases. » Sending with Mail Mime creates attached images to html email messages on PHP 5.2.17 (and not on PHP 5.3)
FileSize
514 bytes

EDIT: Your litmus link sends me to a page full of broken images; each one leads to a 404 error page.

In order to have text and html alternatives, inline images, and attachments in the same email, the MIME structure must be as follows:

1. multipart/mixed
1.1. multipart/alternative
1.1.1. text/plain -- This is the plain-text version of the message.
1.1.2. multipart/related
1.1.2.1. text/html -- This is the HTML version of the message.
1.1.2.2. image/gif -- This is a linked stylesheet image.
1.2. image/jpeg; Content-Disposition=inline -- This is an inline image, displayed after the message.
1.3. application/pdf; Content-Disposition=attachment -- This is a regular file attachment.

So making the first part multipart/related would eliminate the possibility of any text/plain alternative or file attachments.

As for the Content-Disposition attribute, there are only two possible values: 'attachment' and 'inline'.

Are you saying that changing it from 'inline' to 'attachment' will prevent it from showing up as an attachment? That seems rather counter-intuitive.

If true, then the only way to fix it is to edit the Mail/mime.php file in your PEAR directory.

Here's a patch that you can apply to that file.

pillarsdotnet’s picture

Title: Sending with Mail Mime creates attached images to html email messages on PHP 5.2.17 (and not on PHP 5.3) » Linked stylesheet images show up as attachments in some cases.
blasthaus’s picture

Title: Sending with Mail Mime creates attached images to html email messages on PHP 5.2.17 (and not on PHP 5.3) » Linked stylesheet images show up as attachments in some cases.

First off, note: my edit #5.

When setting Content-Type: multipart/alternative, yes this allows for plain text alternative and images (Content-Disposition set to inline or attachment). This seems to be the proper method if one is interested in base64 encoding images in the header.

For me, any images in the (text/html) are getting base64 encoded and tagged Content-Disposition: inline. While it's an interesting method, if you have a lot of images the email becomes weighty. In addition at least from my tests, Gmail displays them additionally as attachment (in some cases, not sure why but its true - this may have to do with a Received-SPF: softfail problem I'm having on one site that's still in development)

It seems to be a logical best practice to not send base64 encoded images within html emails this way
See http://www.campaignmonitor.com/blog/post/1759/embedding-images-revisited/

Is this the intended functionality of Mail Mime or should i suspect something else like mime.php

thanks once again!

blasthaus’s picture

Not sure if this helps, but I've seen this declaration used in headers btw and images display inline, plain text version ok, (no inline images)

Content-Type: multipart/related;
    type="multipart/alternative";
    boundary="xxx"
MIME-Version: 1.0
Content-Transfer-Encoding: 8Bit
etc...and then

This is a multi-part message in MIME format.

--xxx
Content-Type: multipart/alternative;
    boundary="xxx."
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
pillarsdotnet’s picture

Title: Linked stylesheet images show up as attachments in some cases. » HTML Mail should have a configuration option to turn off embedding of linked images.
Project: Mail MIME » HTML Mail
Category: bug » feature
Status: Postponed (maintainer needs more info) » Needs work

Possible encodings are 7bit, 8bit, base64, and quoted-printable. Many mail systems will reject or re-encode 8bit content as it doesn't comply with published RFC standards. Of the other possibilities, only base64 is appropriate to binary content. I suppose you could choose quoted-printable but I'd be very surprised if this somehow makes your images start working.

It looks like you want a way to turn off the embedding of linked images altogether. I will work on making this an option on the HTML Mail configuration page.

pillarsdotnet’s picture

Again, changing from base64 to 8bit requires an edit to the PEAR Mail/mime.php file.

Here is a patch; let me know if it solves your problem.

TR’s picture

Assigned: pillarsdotnet » Unassigned
Issue summary: View changes