use Net::SMTP; unless ($smtp = Net::SMTP->new('mailhost')) { print "Fail\n"; } # print domain print $smtp->domain,"\n"; # send test email $smtp->mail($ENV{USER}); $smtp->to('phil@philvickery.com'); $smtp->data(); $smtp->datasend('To: phil@philvickery.com\n'); $smtp->datasend("\n"); $smtp->datasend("A simple test message\n"); $smtp->dataend(); $smtp->quit;