以下代码(基于Python文档和许多关于MIME消息的文章,方便的子类和技术问题)何时执行它向我展示它启动[pic1]但我必须永远等待并且永远不会开始直到我杀了它
我会告诉你我的代码,我希望找到解决方案!
谢谢!
import smtplib
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart('multipart/related')
filename = "C:\.......\asd.png"
f = file(filename, 'rb')
attachment = MIMEImage(f.read(), _subtype="png")
attachment.add_header('Content-Disposition', 'attachment',filename=filename)
s = smtplib.SMTP('smtp.gmail.com:587')
s.ehlo()
s.starttls()
s.connect('smtp.gmail.com')
s.login('asd@gmail.com','1234')
s.sendmail('asd@gmail.com', 'asd@gmail.com', msg)
s.quit()