Send HTML email through Exim using Perl
Posted on 2004-04-10
I have a linux server RHEL 3.0 with Exim 4 as the mail server. I have a Perl script that is trying to send an HTML email through Exim. However when the message is delivered it always shows up as plain text with all the HTML not being rendered by any of the clients. I am sure this isn't client side as I have tested it with numerous clients who are all able to receive HTML email from other sources.
Here is a snippet of the perl script:
open(MAIL, "|/usr/sbin/exim -t");
print MAIL "To: email@example.com\n";
print MAIL "From: firstname.lastname@example.org\n";
print MAIL "Subject: Place Subject Here\n\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL"Content-Type: text/html; charset=us-ascii\n";
print MAIL "BASIC HTML TAGS GO HERE";
When I send this users seen all my HTML mark up starting with "MIME-Version: 1.0 and Content-Type: text/html". Exim doesn't register those as headers and simply treats them as the body of a text message.