Re: [PHP] Re: CONTENT-type for sending HTML attachments
Manuel Lemos wrote: Hello, on 03/16/2007 12:16 PM Angelo Zanetti said the following: Hi guys. Im using the HTML Mime Mail http://www.phpguru.org/static/mime.mail.html class from phpguru.org. Anyway I've written a few scripts that use the class to attach files to it. These files are HTML reports but Im not sure what MIME content-type to use. The content type I use to for the attachments is text/html. But Im not sure that the content type for the email itself should be plain/text as this just displays the HTML attachment as garbage in the body text. You should never send HTML only messages, as most spam filters will discard your message. Usually you need to have an alternative text part like the messages composed by normal mail clients. 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. TIA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Angelo Zanetti wrote: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Jon Anderson wrote: Angelo Zanetti wrote: 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 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:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Angelo Zanetti wrote: Jon Anderson wrote: Angelo Zanetti wrote: 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 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 This is a feature of some email clients. By default, some will display html, images, documents,... inline rather then as the wanted attachment. In Thunderbird, look under the View menu at the top. See the entry about half way down Display Attachments Inline ?? This will mess with what you, the email creator, is attempting to do. -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php