I'm building a application that sends a test message to another email, the program executes without errors, but when I check my email there isn't any new email, take a look at my code:
my $smtpserver = 'smtp.vix.terra.com.br';
my $smtpuser = 'nathanpc';
my $fromemail = 'nathanpc@terra.com.br';
my $smtp = Net::SMTP-> new($smtpserver, Timeout => 120);
$smtp-> mail($smtpuser);
$smtp-> to('eeepc904@gmail.com');
$smtp-> data();
$smtp-> datasend("To: eeepc904\@gmail.com\n");
$smtp-> datasend("From: nathanpc\@terra.com.br\n");
$smtp-> datasend("\n");
$smtp-> datasend("test\n");
$smtp-> dataend();
$smtp-> quit;
Just sniff the traffic to see if there is any SMTP traffic (default port is 25). If you see there is and it corresponds to what you sent (with no errors), you are fine as far as your code is concerned. Your code can't be responsible for what happens after it has successfully been sent (250 Ok: queued...).
Just because you didn't get the email doesn't mean the email wasn't sent. It could be that it hasn't been delivered yet, or it was delivered and was filtered, or many other things.
There are many, many things that can go wrong with email.
Debug
option in your call tonew
?There is a lot that you can do to help yourself before asking here, and relying on Stackoverflow for even the most basic questions doesn't give you a chance to develop your own skills.
I think this should be fine
Just call:
after creating smtp object to get nice transcription of whole session to console.