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";