use Net::SMTP; use MIME::Lite; my $from='foo@testdomain.com'; my $to='bar@testdomain.com' my $msg_html_rich = new MIME::Lite( From => $from, Subject => 'MIME::Lite Test', To => $to, Type => 'multipart/alternative'); attach $msg_html_rich Type =>'text/plain', Data =>'message in plain text'; attach $msg_html_rich Type =>'text/html', Data =>'message in HTML with many markup tags'; my $smtp= Net::SMTP->new('127.0.0.1', Timeout => 180); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend($msg_html_rich->as_string); $smtp->dataend();