Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is there any way for Say NET::SMTP to talk to a smtp server and find out if a user is valid, and if not, have it return a error code?

Replies are listed 'Best First'.
Re: SMTP Validation
by chromatic (Archbishop) on Feb 25, 2000 at 21:16 UTC
    According to the documentation for Net::SMTP (take the link to CPAN), the recipients() method can return an array of addresses that succeeded, if you pass the hash slice ( SkipBad => "true" ). Otherwise, it will return an error.

    This may not mean that the address is valid, however, just that the server cannot send to that address.

Re: SMTP Validation
by Anonymous Monk on Feb 26, 2000 at 20:47 UTC
    If the server is an esmtp server, you can issue commands link VRFY. There is also another command that you can use. I think it's EXPN or something like that. At any rate, you should be on to a good start. The VRFY command is used to verify that an email address is configured for delivery at said host.
      Problem with that is that VRFY and EXPN can both be turned off by the server admin, so all you can really say is that the address doesn't appear to be deliverable if these methods fail.
Re: SMTP Validation
by Anonymous Monk on Feb 27, 2000 at 03:23 UTC
    Well the thing is, I admin the box that these scripts run on, and this host sends out a good 200,300 e-mails a week, So I get flooded with bogus e-mail warnings from sendmail. And I want someway for the scripts to go "oh, this is a bad address" and mark the user db with the info.