recipient validation with smtplib

Robin Becker robin at reportlab.com
Fri Sep 28 07:50:54 EDT 2007


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.
-- 
Robin Becker




More information about the Python-list mailing list