如果你使用 Python smtplib.py 寄信時,遇到認證錯誤訊息(Authentication error),不妨試試改變一下認證的順序,請在 smtplib.py 裡面找
# List of authentication methods we support: from preferred to # less preferred methods. Except for the purpose of testing the weaker # ones, we prefer stronger methods like CRAM-MD5: preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN, AUTH_LOGIN]
然後修改一下順序,
preferred_auths = [AUTH_LOGIN, AUTH_CRAM_MD5, AUTH_PLAIN]
或許就能迎刃而解。