The example of this article for everyone to share the Python email Lite Code, for your reference, the specific content as follows
Import smtplibfrom email.mime.text import mimetextfrom email.utils import formataddr# send mail function def send_mail (send_message_ txt,*senders_list,**send_to_people): flag = True try: #编写发送的内容 send_msg = Mimetext (send_message_ TXT, "plain", "Utf-8") send_msg["from"] = formataddr (["Sender name", "email account"]) #f发送人的名单 for Sender_name,mail_ Address in Send_to_people.items (): send_msg["to"] = FORMATADDR ([sender_name,mail_address]) else: print ("Add all Senders") send_msg["Subject"] = "Sqlmap file contents with exception" #登录邮箱服务器 send_server = smtplib. SMTP ("smtp.126.com") send_server.login ("Login email account", "email password") #发送邮件 send_server.sendmail (" Zqgcy0808@126.com ", senders_list,send_msg.as_string ()) send_server.quit () except Exception as E: Print (e) flag = False return flag
The above is the whole content of this article, I hope that everyone's learning has helped, but also hope that we support topic.alibabacloud.com.