I'm trying to send some emails with Net::SMTP, and all goes well except that I can't figure out how to tell if the mail was sent successfully. I have to record which emails are real and which receive a "User Unknown" response.
I saw this post Net:SMTP Printing to STDOUT, and according to that, and the Net::SMTP manual and Net::Cmd manual, I should do this:
$smtp = Net::SMTP->new('smtp.host.com'); $smtp->mail('someone@example.com'); $smtp->to('someone@example.com'); my $ret = $smtp->data($maildata);
If my $ret value is true, it was a sucess. If false, the mail was not sent.
That works fine when the recipient's domain is handled by the same host as I am using as my SMTP relay (smtp.host.com) but if I am sending to a non-existing recipient on another host, I want to receive false, or a "User Unknown" message. Instead, it returns true.
Any ideas how I can figure out if the mail made it without parsing the maillog, and without doing a lookup on each mailaddress, and using their MX record instead of smtp.host.com ?
In reply to Net::SMTP success / failure response by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |