Skip navigation.
Your source for Perl tips, howto's, faq and tutorials
( categories: )

There are many ways to send e-mails using Perl. One simple way is to use the module Mail::Send:

use Mail::Send;
$body = "This is the body of the message";
#-- initialize the object
$msg = new Mail::Send Subject=>'example subject', To=>'user1', Cc=>'user2@host';
#-- launch mailer and set headers
$fh = $msg->open;
#-- print the message body
print $fh "Hello,\n";
print $fh "$body\n";
#-- complete the message and send it

If you want to send html emails using Perl, click here