use Mail::Mailer; my $body = "This is the message body, line 1\n"; $body .= "This is the message body, line 2\n"; my $mailer = Mail::Mailer->new( 'smtp', Server => 'smtp-server.example.com') or die "Unable to create a new mailer object:$!\n"; $mailer->open({ From => "jfluhmann\@example.com", To => "jeremy\@example.com", Subject => "Test E-mail"}) or die "Unable to populate mailer object:$!\n"; print $mailer $body; $mailer->close;