my $smtp = Net::SMTP->new('smtp.orcon.net.nz', Timeout => 30, Debug => 0, # Prevent debug info to STDOUT ); $smtp->mail('no@one.com'); # Don't need to escape @ in single-quotes $smtp->to('xxx@yyy.com'); # Fixed typo; you forgot opening quote. :) $smtp->data(); $smtp->datasend("To: xxx\@yyy.com\n"); $smtp->datasend("\n"); $smtp->datasend("A simple test message\n"); my $res = $smtp->dataend(); $smtp->quit; print "Operation was ", $res ? '' : 'un', "successful.\n"; #### 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;