标签:收件人 com style tle dma key return 构造 发送邮件
------------恢复内容开始------------
#发送邮件 #sender: 发送者 #pwd: key #recver: 收件人 #title: 标题 #text : 内容 def sendMail(sender, sendername, pwd, recver, recvername, title, text): ret = True print("Send to " + recver) try: #构造邮件 msg = MIMEText(text,‘plain‘,‘utf-8‘) msg[‘From‘]=formataddr([sendername,sender]) msg[‘To‘]=formataddr([recvername,recver]) msg[‘Subject‘]=title #发送邮件 server=smtplib.SMTP_SSL("smtp.qq.com", 465) server.login(my_sender, my_pass) server.sendmail(my_sender,[recver,],msg.as_string()) server.quit() except Exception as e: print("Error: ", e) ret = False return ret
------------恢复内容结束------------
标签:收件人 com style tle dma key return 构造 发送邮件
原文地址:https://www.cnblogs.com/HadesBlog/p/13280485.html