If you can send ascii text mail, you should be able to change the Content-type to text/html and generate your html as a here-doc, then just put the here-doc in your datasend method. Usually it's recommended to generate your html with MIME::Lite, then use your TLS datasend method to send the MIME::Lite object.
Here is a completely untested example, that should show you the basic idea, based on the example code from the TLS module. You first create your html with MIME::Lite, then use TLS's datasend to send the MIME::Lite with the as_string method.
use strict;
use MIME::Lite;
use Net::SMTP::TLS;
# Send HTML document with inline images
# Create a new MIME Lite object
my $msg = MIME::Lite->new(
From =>'foo@gmail.com',
To =>'whoever@wherever.com',
Subject =>'Hi',
Type =>'multipart/related');
# Add the body to your HTML message
$msg->attach(Type => 'text/html',
Data => qq{ <BODY BGCOLOR=#FFFFFF>
<H2>Hi</H2>
<P ALIGN="left">
This is an HTML message.
</P>
<P ALIGN="left">
<A HREF="http://foo123.com/">Here's a link</A>.
</P>
<P ALIGN="middle">
<IMG SRC="cid:2uni2.jpg">
</P>
</BODY> });
# Attach the image
$msg->attach(Type => 'image/jpg',
Id => '2uni2.jpg',
Path => '2uni2.jpg');
# Send it with TLS
my $mailer = new Net::SMTP::TLS(
'gmail.com',
Port => 465,
User => 'foo',
Password=> 's3cr3t');
$mailer->mail('foo@gmail.com');
$mailer->to('whoever@wherever.com');
$mailer->data;
# this is where you send the MIME::Lite object
$mailer->datasend( $msg->as_string );
$mailer->dataend;
$mailer->quit;
|