Any idea? Here is the code I am using:
#!/usr/local/bin/perl
use strict;
use MIME::QuotedPrint;
use HTML::Entities;
use Mail::Sendmail;
my $boundary = "====" . time() . "====";
my %mail = (
from => 'x...@xxx.com',
to => 'x...@xxx.com',
subject => 'Test HTML mail',
'content-type' => "multipart/alternative;
boundary=\"$boundary\""
);
$boundary = '--'.$boundary;
$mail{body} = <<END_OF_BODY;
$boundary
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
Please visit our site <a href="http://cyberciti.biz/";>online</a><hr>
<img src="http://boardingbandit.com/printedatbanner.jpg">
</html>
$boundary--
END_OF_BODY
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
You are specifying quoted-printable encoding, but you don't seem to be
sending the HTML encoded at all.
Either use
Content-Transfer-Encoding: 8bit
(as you discovered)
Or encode your HTML first, instead of writing it straight into the
body:
$html = q{ your html code };
$html = encode_qp($html);
This is better, because in case your HTML has lines exceeding the
maximum length for email messages, the encoding will automatically take
care of splitting such lines.