Re: Formatting e-mail using mail()

From: Date: Wed, 23 Feb 2005 09:19:13 +0000
Subject: Re: Formatting e-mail using mail()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-209216@lists.php.net to get a copy of this message
Burhan Khalid wrote:
Jacques wrote:
Can I format an e-mail message with html tags inside the mail() function? If not, how can I go about it? I would like to format the layout of the e-mail message using tables, colors and perhaps images.
Please, FFS RTFM > http://www.php.net/manual/en/function.mail.php
and when your done brushing up on the mail function and related material have a google for 'phpmailer' - a lovely class that abstracts out all the headache stuff associated with formatting an email properly (headers, multi-part MIME, boundaries, etc) Tip: don't go stuffing HTML tagsoup into the body of an email mail()ing it. not everyone likes html email - some can't read it [AOL users/email-apps are a nightmare] its better to offer a plaintext version of the message as well as the singing and dancing version (best/safest is to go purely plaintext but then again you probably have one of those insistent marketing depts on you back ;-).... don't assume that because Outlook can view your html email as intended that other programs can too! Another thing - if you intend to include images beware that there are 2 ways to do it. 1 include the image file in the msg (make use of a 'cid:' src value for the IMG tag in the HTML) 2. reference images that are on your public webserver.... this is way better it terms of bnadwidth, sometimes there is a requirement for offline reading (in which case you may have to embed the files instead)

« previous php.general (#209216) next »