use Net::SMTP; $smtp = Net::SMTP->new('mailhost', Timeout => 60); $smtp->mail($from_address); $smtp->to($to_address); $smtp->data(); $smtp->datasend($the_email_with_headers); $smtp->dataend(); $smtp->quit;