#!/usr/bin/python
import smtplib
import string
HOST="smtp.gmail.com" //发件SMTP主机
tolist=['12345@qq.com','56789@qq.com','18900000000@189.cn'] //收件人列表
FROM="xxxx@gmail.com" //发件人邮箱
SUBJECT="Python Module stmplib test email" //邮件主题
bodys=""" //内容
This is a test mail please delete this mail thank you """
BODY = string.join((
"From: %s" % FROM,
"To: %s" % ';'.join(tolist),
"Subject: %s" % SUBJECT,
"",
bodys
),"\r\n")
server=smtplib.SMTP()
server.connect(HOST,"25")
server.starttls()
server.login("xxxx@gmail.com","emailpassword") //发件人账户和密码
server.sendmail(FROM,tolist,BODY) //发送邮件
server.quit()