发送邮件,,#!/usr/bin/e
文章由Byrx.net分享于2019-03-23 05:03:05
发送邮件,,#!/usr/bin/e
#!/usr/bin/env python#_*_encoding:utf-8_*_import smtplibimport stringFROM = raw_input("请输入您的邮箱地址:")FROM_PASS = raw_input("请输入您的邮箱密码:")HOST = raw_input("请输入您的邮箱SMTP服务器地址(例如:smtp.qq.com:):")TO = raw_input("请输入对方邮箱地址:")SUBJECT = "Mail"text = "This is a test mail !"BODY = string.join(( "FROM: %s" % FROM, "TO: %s" % TO, "Suject: %s" % SUBJECT, "", text ),"\r\n")server = smtplib.SMTP()server.connect(HOST,"25")server.login(FROM,FROM_PASS)server.sendmail(FROM,[TO],BODY)server.quit()
评论关闭