smtplib send mail dns resolve problem

星星 starstarstarpku at gmail.com
Mon Oct 19 03:44:14 EDT 2009


hello everyone,
     I am using smtplib to send email, and i meet such a problem:

    my email smtp server hostname can be parsed to 5 ips, for example:
    ******************************************************************
     my email smtp server hostname:  email-my.local.com
     ips through dns parse:
    1.1.1.1
    1.1.1.12
    1.1.13.1
    1.1.1.14
    1.1.1.15
    ******************************************************************

    but when i send mail using smtplib, i was always using one ip, no
dns re-resolve happened, (for example: only use 1.1.1.12). I checked
smtplib src code, but i can't find anything strange;

    here is my smtplib send mail client code:
 
********************************************************************
    for i in range(1000):
        server = smtplib.SMTP(host)
        try:
             server.sendmail(fromaddr, toaddr, msg)
        except Exception, e:
             logger.warning('sendmail exception')
        else:
             pass
        finally:
             server.quit()
        time.sleep(0.3)
 
********************************************************************

    Can anyone give some tips? Thank you!



More information about the Python-list mailing list