python一个发邮件的函数
fromdatetime import date,timedelta
from email.mime.text import MIMEText
def mailto(rec_list,mail_content):
sender=-.com'
smtpserver='.com'
user='guanzhongkai'
passwd=''
content = file(mail_content ).read()
msg=MIMEText(content,'plain')
msg['From']=sender
msg['Subject']="PV last week of Mobile-BU"
msg['To']=",".join(rec_list)
smtp=smtplib.SMTP()
smtp.connect('','')
smtp.starttls()
# smtp.set_debuglevel(1)
smtp.login(user,passwd)
smtp.sendmail(sender,rec_list,msg.as_string())
smtp.quit()
页:
[1]