use Net::SMTP; my $smtp = Net::SMTP->new('smtp.example.com', Timeout => 30, Debug => 0, # Prevent debug info to STDOUT ); $smtp->mail('someone@example.com'); $smtp->to('someone@example.com'); my $ret = $smtp->data(<<'EOM'); From: someone@example.com To: someone@example.com Subject: Test Message A simple test message. EOM print "Operation was ", $ret ? '' : 'un', "successfull.\n"; print "(Got response: ", $smtp->message(), ")\n"; $smtp->quit;