#!/usr/bin/env python
#coding:utf8
import smtplib,sys
from email.mime.text import MIMEText
from config.mailss import mail_list,content
def send_mail():
mail_host,mail_user,mail_pass,mail_postfix,sub,me,mailto_list = mail_list
me=mail_user+"<"+mail_user+"@"+mail_postfix+">"
for i in xrange(len(content)):
msg = MIMEText(content[i],_charset=‘gbk‘)
msg[‘Subject‘] = sub
msg[‘From‘] = me
for i in mailto_list:
msg[‘To‘] = "".join(i)
# try:
s = smtplib.SMTP()
s.connect(mail_host)
s.login(mail_user,mail_pass)
s.sendmail(me, mailto_list, msg.as_string())
s.close()
python不同的内容邮件群发
时间: 2024-11-10 23:08:26