| John smith 2005-07-30, 9:59 pm |
| I need to set up a process to send both html and text eamils from within
perl. I can make things work to send the text based email but even a simple
html email is always sent as text. I have not even gotten to the stage of
trying both in the same email
Nearest I can figure the following should send a simple html email
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$title='mail test';
$to='recipient\@address.net';
$from= 'sender\@address.net';
$subject='Using Sendmail';
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test message\n";
close(MAIL);
print "<html><head><title>$title</title></head>\n<body>\n\n";
## START HTML content
print "<h1>$title</h1>\n";
print "<p>A message has been sent from $from to $to";
## END HTML CONTENT
print "\n\n</body></html>";
|