[thelist] HTML EMAIL

Matthew Blanchard blanchardmatthew at hotmail.com
Wed Dec 5 07:25:50 CST 2001


From: "Adrian Fischer" <adrian at aussiebidder.com>
Subject: [thelist] HTML EMAIL


> 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

These are called headers.

>   open MAIL, "|$config{'mailprog'}";
>                print MAIL "To: $to\r\nFrom: $from\r\nSubject:
> $subject\r\n\r\n$message\n";

"to", "from" and "subject" are headers too, and the rule indeed says that an
empty line must seperate them from the body of the message.

> ..but how do I add the header info.

Just print all the headers together. A clearer syntax is:

open MAIL, "|$config{'mailprog'}";

print MAIL <<EOS;
To: $to
From: $from
Subject: $subject
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

EOS

print MAIL $message\n";
close MAIL;







More information about the thelist mailing list