use strict; use Net::SMTP; my $recipient1 = 'john@hotmail.com'; my $smtp = Net::SMTP->new('mailhost.com', ); $smtp->mail ($ENV{USER}); $smtp->recipient($recipient1); $smtp->data(); $smtp->datasend("This is a test"); $smtp->datasend(); $smtp->quit;