recipient validation with smtplib

Steve Holden steve at holdenweb.com
Fri Sep 28 08:25:17 EDT 2007


Robin Becker wrote:
> Tim Williams wrote:
>> On 28/09/2007, Robin Becker <robin at reportlab.com> wrote:
>>> Is there a way to use smtplib to get recipient validation. I can use smtplib
>>> quite happily to send emails using the locahost's sendmail, but sendmail is just
>>>  fire and forget, so some bad addresses eg idiot at www.dingo.zzz don't cause any
>>> error in the sending application. I know some smtp setups do enforce recipient
>>> validation, but it doesn't seem terribly easy to do this with sendmail. I
>>> wondered if there were some way to do this in python?
>> There is no way of  validating *every* email address you send to using
>> SMTP alone.   Some servers accept every address and bounce later - as
>> you have found out. So for the purpose of the SMTP client, or relaying
>> server,  the address is valid at sending time to those servers.
>>
>> Checking DNS for MX records is a possibility for removing some bad
>> addresses, but it's not fool proof as the RFCs don't require MX
>> records to exist for a domain to be able to receive email.  If no MX
>> records are present, one (and only one!) IP address returned from the
>> domain's A record(s) should be tried.
>>
>> HTH :)
> Thanks, it's at least ammunition for me to say it cannot easily be done. I found 
> this milter
> 
> http://www.jmaimon.com/sendmail/callahead-milter/
> 
> but I think this will cause every send to be checked which is probably not what 
> we need.

I have a client who gets many spurious web sign-ups (they are a 
telephone service). One of the signs of fraud is a bogus email address, 
  so it became very important to detect these.

The only way we could satisfactorily do so was to process the mailbox 
that received the bounces and detect a GUID in the bounce message to 
identify the potentially bogus accounts. This apparently works well 
enough to stop most scammers from making their first 'phone call. In 
general there is no way to tell when sending that an address is or is 
not valid.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline




More information about the Python-list mailing list