Re: Re: CONTENT-type for sending HTML attachments
| From: | Angelo Zanetti | Date: | Tue, 20 Mar 2007 14:12:21 +0000 |
| Subject: | Re: Re: CONTENT-type for sending HTML attachments | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250915@lists.php.net to get a copy of this message | ||
Jon Anderson wrote:
Angelo Zanetti wrote:Thanks jon, thats what im trying to do... However with the adding attachemnt you can specify the content type. I have used text/html and application/octet-stream to force them to be as attachments. They seem to work in my webmail but when opened with thunderbird I get a whole long message with binary. Is that a thunderbird problem or is there inconsistencies in the way web clients and mail clients read attachments and mime types? Im going to try my Gmail account and see what I get... Thanks again. If you have any other advise that I might be missing that'll be great. Thanks -- ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za>So if the HTML files are attachments and the text is just plain text then will the content-type of the message be text/plain and then each attachment be multipart/alternative. Please note that the HTML files need to be sent as attachments and not part of the body. On my email client I was receiving the emails correctly (IE: message body and HTML files as attachments) but on my client's email client they were just receiving blank messages. I'm just a little confused about the content types as you might have gathered.You're trying to do this, right? MIME Email -> Part 1: Text Message (The message that you want displayed) -> Part 2: HTML Attachment -> Part 3: HTML Attachment -> ... -> Part N: HTML Attachment Because it's a mime email, your text part will be a mime part (an attachment) as well, but basically any mail reader these days will render that as the main part. You want your main email ("MIME Email" above) to have a multipart/alternative content type. Your text part ("Part 1" above) should be text/plain. Each HTML part ("Part 2" to "Part N" above) could be text/html. If you want to force those HTML parts as attachments you could use application/octet-stream for the content type - mail readers should treat them as binary. Whatever mime class you're using should hopefully take care of any encoding that may or may not be necessary. jon