in reply to Net::SMTP success / failure response

It can't be done that way.

For instance, if the remote machine is down, your mail server will be retrying your mail (in increasingly large intervals) for the next week or so, long after your script has disconnected.

There is no way to predict what the remote machine will say. In fact, in some cases the remote machine will accept the mail, and then it will send back a bounce.

Most of the methods which enabled you to connect to a given machine and ascertain if an email address local to that machine is valid or not have been disabled, because spammers were using them to generate target email addresses.

  • Comment on Re: Net::SMTP success / failure response

Replies are listed 'Best First'.
Re:x2 Net::SMTP success / failure response
by grinder (Bishop) on Mar 31, 2004 at 09:40 UTC
    your mail server will be retrying your mail

    Not quite true. It is in the general case yes, but Net::SMTP handles the connection itself, and does not hand off to your MTA, so it will deliver the mail, or die in the attempt :) (update: oops, unless you connect to your MTA... but if you're connecting directly to their MTA, in the hope of collecting the response code and message, this would be the case).

    the remote machine will accept the mail, and then it will send back a bounce

    Most notably, aol.com does this. Their user base being the size it is, I assume they decided that it would be too difficult to validate addresses on the perimeter in a timely manner. So they accept it, and then they can take all the time they like to figure out whether it can be delivered. This means that they then have to deal with bogus return paths for bounced spam, but in their terms of use they do say that they will reject mail from your host if a certain percentage of bounces bounce back to them.

      Net::SMTP talks whatever server you tell it to. In 99% of the time, that is the local MTA that relays it to the destination server. Finding the destination server requires looking up the MX records and acting like an MTA.

      For this problem of finding which email addresses are valid, that may be a good solution.

Re: Re: Net::SMTP success / failure response
by Anonymous Monk on Mar 31, 2004 at 09:44 UTC
    I realize that some cases will make it impossible, I am willing to accept that. I'm just looking for a best effort right now.

    If the machine accepts the mail, and then bounces it later, I'll count it as accepted until I receive the bounced mail.