use MIME::Lite; use MIME::QuotedPrint; # # this part generates $email_body for plain text and $email_html for html text # $msg = MIME::Lite->new( To =>$email_to, From =>$email_of_sender, Subject =>$email_subject, Type =>'multipart/alternative', ); $msg->attach(Type => 'text/plain', Data => $email_body ); $msg->attach(Type => 'text/html', Data => encode_qp($email_html) ); $msg->send;