mail.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from email.header import Header from email.mime.text import MIMEText import smtplib import sys def sendmail(subject, content): sender = 'abc@163.com' password = 'abc' recipients = 'abc@qq.com' host = 'smtp.abc.com' msg = MIMEText(content, 'plain', 'utf-8') msg['From'] = sender msg['To'] = recipients msg['Subject'] = Header(subject, 'utf-8').encode() server = smtplib.SMTP_SSL(host, 465) server.login(sender, password) server.sendmail(sender, [recipients], msg.as_string()) server.quit() sendmail(sys.argv[1],sys.argv[2]) #参数1title,参数2content |
- 本文固定链接: https://www.yoyoask.com/?p=2096
- 转载请注明: shooter 于 SHOOTER 发表