Python简单实现邮件群发
import smtplib from email.mime.text import MIMEText from email.utils import formataddr msg = MIMEText('xaaxaxaxafdjikgjhdjfg', 'plain', 'utf-8') msg['From'] = formataddr(["张三",'zhangsan@126.com']) msg['To'] = formataddr(["李四",'lisi@163.com']) msg['Subject'] = "邮件主题" server = smtplib.SMTP("smtp.126.com", 25) #端口 server.login("zhangsan@126.com", "asdfadfsdfa") server.sendmail('zhangsan@126.com', ['lisi@163.com',‘wangwu@163.com’], msg.as_string()) server.quit()