On 28/09/2007, Robin Becker <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] 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 :) -- http://mail.python.org/mailman/listinfo/python-list