Just because you didn't get the email doesn't mean the email wasn't sent. I 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.
- Where's the part of the script with warnings and strict enabled, and you load Net::SMTP? Help yourself with those before running to Stackoverflow.
- Why don't you check that you were able to connect to the mail server?
- Why haven't you enabled the
Debug
option in your call to new
?
- Were there any warnings or error messages?
- What happens when you try the same SMTP conversation by manually connecting to the server? Post the entire transcript.
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.
#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtpserver = 'smtp.vix.terra.com.br';
my $smtpuser = 'nathanpc';
my $fromemail = '[email protected]';
my $smtp = Net::SMTP->new($smtpserver, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;
$smtp->mail($smtpuser);
$smtp->to('[email protected]');
$smtp->data();
$smtp->datasend("To: eeepc904\@gmail.com\n");
$smtp->datasend("From: $fromemail\n");
$smtp->datasend("\n");
$smtp->datasend("test\n");
$smtp->dataend();
$smtp->quit;