[thelist] HTML EMAIL

Daniel J. Cody djc at members.evolt.org
Wed Dec 5 09:59:06 CST 2001


Hi Adrian -

Here's the set of headers I use when sending out HTML email:

Errors: postmaster at yourdomain.com
From: sales at yourdomain.com <sales at yourdomain.com>
To: foo at someoneelse.com
Subject: HTML Email
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="file.html"
Content-Base: http://www.yourdomain.com/email
<insert html here>


i save that file with headers & HTML to a file named 'file.html' and 
then pipe it to sendmail. All the images referenced in the HTML are 
pointing at an absolute URL on a webserver somewhere so I don't have to 
deal with multi-part mails(another nightmare). Then it gets piped to 
sendmail with the -t flag like so: "sendmail -t < file.html"

Not the cleanest way to do it, but just another way :)

hope that helps a bit..

.djc.


Adrian Fischer wrote:

> Hi People,
> 
> I searched the archives because I thought I had seen a lengthy discussion on
> this in the past but couldn't find anything.  I also found very little on
> the net (must have been using the wrong query!)
> 
> I need to be able to send an email in html format. From what I have been
> able to glean so far I need to add headers to what I've got. I'm hosted on a
> unix/linux box and cant change config files so I need to send the header
> information to Sendmail on the fly  Something like this what I need to add:
> 
> #MIME-Version: 1.0
> #Content-Type: text/html; charset=us-ascii
> #Content-Transfer-Encoding: 7bit
> 
> (without the # sign)
> 
> This is how I send email from within my program presently:
> $config{'mailprog'} = '/usr/lib/sendmail -t';
> <snip>
>   open MAIL, "|$config{'mailprog'}";
>                print MAIL "To: $to\r\nFrom: $from\r\nSubject:
> $subject\r\n\r\n$message\n";
> 
>                 close MAIL;
> </snip>
> 
> ..but how do I add the header info.
> 
> (Marking up the $message isnt a problem)
> 
> Any and all help is appreciated.







More information about the thelist mailing list