#!/usr/bin/pythonimport smtplibimport stringHOST="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()