Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
CONTENT-type for sending HTML attachments
Old
  (#1)
Angelo Zanetti
Guest
 
Posts: n/a
Default CONTENT-type for sending HTML attachments - 05-14-2007, 03:53 AM

Hi guys.

Im using the HTML Mime Mail
<http://www.phpguru.org/static/mime.mail.html> cl*** from phpguru.org.
Anyway I've written a few scripts that use the cl*** 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.

Please could anyone advise, what the content type should be.

Thanks,

Kind regards
Angelo
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: [PHP] CONTENT-type for sending HTML attachments
Old
  (#2)
Tijnema !
Guest
 
Posts: n/a
Default Re: [PHP] CONTENT-type for sending HTML attachments - 05-14-2007, 03:53 AM

On 3/16/07, Angelo Zanetti <EMAIL REMOVED> wrote:
> Hi guys.
>
> Im using the HTML Mime Mail
> <http://www.phpguru.org/static/mime.mail.html> cl*** from phpguru.org.
> Anyway I've written a few scripts that use the cl*** 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.
>
> Please could anyone advise, what the content type should be.
>
> Thanks,
>
> Kind regards
> Angelo


AFAIK html has the text/html mime-type.

Tijnema
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: CONTENT-type for sending HTML attachments
Old
  (#3)
Manuel Lemos
Guest
 
Posts: n/a
Default Re: CONTENT-type for sending HTML attachments - 05-14-2007, 03:53 AM

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> cl*** from phpguru.org.
> Anyway I've written a few scripts that use the cl*** 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.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Cl***es - Free ready to use OOP components written in PHP
http://www.phpcl***es.org/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] CONTENT-type for sending HTML attachments
Old
  (#4)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] CONTENT-type for sending HTML attachments - 05-14-2007, 03:54 AM

On Fri, March 16, 2007 10:16 am, Angelo Zanetti wrote:
> Im using the HTML Mime Mail
> <http://www.phpguru.org/static/mime.mail.html> cl*** from phpguru.org.
> Anyway I've written a few scripts that use the cl*** 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.
>
> Please could anyone advise, what the content type should be.


I would hazard a guest that is should be text/html, if you are sending
html enhanced (cough, cough) email...

Hopefully you realize that doing this drastically reduces the number
of people who will actually get the email, as the spammers all use
html enhanced email, so the spam filters all penalize for it.

And, of course, some of us use mail clients that won't display html
email unless we click a couple extra times, since html enhanced email
is a blatant security hole waiting to be exploited.

So even if the email gets to my Inbox, the odds that I'll bother to
read it are much much worse.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Old
  (#5)
Angelo Zanetti
Guest
 
Posts: n/a
Default Re: [PHP] Re: CONTENT-type for sending HTML attachments - 05-14-2007, 03:55 AM



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> cl*** from phpguru.org.
>> Anyway I've written a few scripts that use the cl*** 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.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Old
  (#6)
Jon Anderson
Guest
 
Posts: n/a
Default Re: [PHP] Re: CONTENT-type for sending HTML attachments - 05-14-2007, 03:55 AM

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 cl*** you're using should
hopefully take care of any encoding that may or may not be necessary.

jon
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Old
  (#7)
Angelo Zanetti
Guest
 
Posts: n/a
Default Re: [PHP] Re: CONTENT-type for sending HTML attachments - 05-14-2007, 03:55 AM



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 cl***
> 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 REMOVED <private.php?do=newpm&u=>
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Re: CONTENT-type for sending HTML attachments
Old
  (#8)
Jim Lucas
Guest
 
Posts: n/a
Default Re: [PHP] Re: CONTENT-type for sending HTML attachments - 05-14-2007, 03:55 AM

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 cl***
>> 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
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top