Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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 ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SMTP success / failure response
by matija (Priest) on Mar 31, 2004 at 08:51 UTC | |
by grinder (Bishop) on Mar 31, 2004 at 09:40 UTC | |
by iburrell (Chaplain) on Apr 01, 2004 at 04:00 UTC | |
by Anonymous Monk on Mar 31, 2004 at 09:44 UTC | |
|
Re: Net::SMTP success / failure response
by Happy-the-monk (Canon) on Mar 31, 2004 at 09:29 UTC | |
by Anonymous Monk on Mar 31, 2004 at 09:50 UTC | |
|
Re: Net::SMTP success / failure response
by idsfa (Vicar) on Mar 31, 2004 at 17:27 UTC | |
|
Re: Net::SMTP success / failure response
by eclark (Scribe) on Mar 31, 2004 at 18:06 UTC | |
by Anonymous Monk on Apr 01, 2004 at 01:21 UTC |