Python,发送电子邮件,代理

时间:2019-12-06 16:08:39

标签: python proxy smtp

我有一个发送电子邮件的探针。代码:

import smtplib
import socks

socks.setdefaultproxy(socks.SOCKS5, '10.21.197.46', 8080)
socks.wrapmodule(smtplib)

smtpserver = 'smtp.savana.cz'
AUTHREQUIRED = 1 
smtpuser = 'email@email.cz'  
smtppass = 'pass'  

RECIPIENTS = 'to@email.cz'
SENDER = 'from@email.cz'
mssg = "test message"
s = mssg   

server = smtplib.SMTP(smtpserver,465)
server.ehlo()
server.starttls() 
server.ehlo()
server.login(smtpuser,smtppass)
server.set_debuglevel(1)
server.sendmail(SENDER, [RECIPIENTS], s)
server.quit()

但是结果是程序卡住了(启动后20分钟)

enter image description here

谢谢您的建议。

0 个答案:

没有答案