0
我想通過經過身份驗證的http代理在python中使用chilkat mailman api發送電子郵件。我儘可能按照Chilkat docs的說明操作,但是在代理服務器方面存在問題。我已經驗證了這個代理使用phantomjs腳本給定了指定的端口和auth。使用經過身份驗證的HTTP代理髮送帶有Chilkat Mailman的郵件
import chilkat
# The mailman object is used for sending and receiving email.
mailman = chilkat.CkMailMan()
# set the http proxy
mailman.put_HttpProxyAuthMethod("LOGIN")
mailman.put_HttpProxyHostname("xxx.xxx.xxx.xxx")
mailman.put_HttpProxyPort(xxxxx)
mailman.put_HttpProxyUsername("xxxxx")
mailman.put_HttpProxyPassword("xxxxx")
# Set the SMTP server.
mailman.put_SmtpHost("smtp.live.com")
mailman.put_StartTLS(True)
mailman.put_SmtpPort(25)
# Set the SMTP login/password (if required)
mailman.put_SmtpUsername("xxxxxxx")
mailman.put_SmtpPassword("xxxxxxx")
# Create a new email object
email = chilkat.CkEmail()
email.put_Subject("This is a test")
email.put_Body("This is a test")
email.put_From("[email protected]")
email.AddTo("Chris Johnson","[email protected]")
# Call SendEmail to connect to the SMTP server via the HTTP proxy and send.
success = mailman.SendEmail(email)
if (success != True):
print(mailman.lastErrorText())
sys.exit()
如果我拿出設置代理的部分,郵件成功發送。是否還有一些其他屬性我缺少?