[thelist] html Mail in Perl

Anthony Baratta Anthony at Baratta.com
Thu Nov 9 00:09:42 CST 2000


Adrian Fischer wrote:
> 
> Heres my question for the day...Is it possible to send html formatted email
> from within a perl/mysql dirven program?  Putting the html into the script
> itself doesn't work.  I think you need to have some sort of header
> information telling it that its html?  If so I don't know how or were.

You need to format the email so that HTML compliant email readers know the HTML is
embedded into the body of the message.

There a a few places on the net that discuss formatting HTML email. I hope someone
else provides the links - I never kept any of the ones tossed out here for previous
responses to this question.

A quick look at some of the spam I get, shows two ways to format the email.

One is to embed a new email header:

	Content-Type: text/html; charset="iso-8859-1"

Then the whole email message will be interpreted as HTML.


Two is to allow part for text and part for HTML:

This goes in the header: 

	Content-Type: multipart/mixed; boundary="------------4654AA3D6893237A52FACAAF"

Watch for wrap. Also the boundary is completely made up, but must be used exactly the
same through out the message.

The for the first part of the email you might want a plain text message:

--------------4654AA3D6893237A52FACAAF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Plain test message goes here

--------------4654AA3D6893237A52FACAAF
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="name of html file"

HTML goes here


And then you need a boundary to end the message.

--------------4654AA3D6893237A52FACAAF--


Thats the basics in a nutshell.

-- 
Anthony Baratta
President
KeyBoard Jockeys
                    South Park Speaks Version 3 is here!!!
                       http://www.baratta.com/southpark
                              Powered by Tsunami




More information about the thelist mailing list