Re: How do you send stylized email?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 02/26/2008 11:53 AM tedd said the following:
>>> $message = <<<EOT
>>> Title: This is a title of the Event.
>>> Time: This the time of the Event.
>>>
>>> Please show up on time.
>>> EOT
>>>
>>> mail('example@xxxxxxxxxxx' , 'An Event' , $message);
>>>
>>> If so, how do you style it?
>>>
>>> If not, how do you send stylized email?
>>
>> The easiest way is this:
>>
>> $message = <<<EOT
>> <span style="color: red">
>> Title: This is a title of the Event.
>> Time: This the time of the Event.
>> </span>
>>
>> Please show up on time.
>> EOT
>>
>> mail('example@xxxxxxxxxxx' , 'An Event' , $message, 'Content-Type:
>> text/html');
> 
> Duh!
> 
> I should have thought of that.

Be careful. Do not send HTML only messages or else some mail systems
(notably Hotmail for instance) will discard your messages as if they
were spam.

The right solution to send HTML messages is to use multipart/alternative
messages so you can specify an alternative text to show in mail clients
that do not support HTML messages.

It is a bit more complex solution, but if you want all people to get
your message, it is necessary. To simplify the problem you may want to
use a ready to use PHP component that can compose multipart/alternative
messages. I use this popular MIME message composing class. Try the
test_simple_html_mail_message example script for instance.

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux