python代码:
#!/usr/bin/env python
#_*_encoding:utf-8_*_
import smtplib
import string
FROM = 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
),"rn")
server = smtplib.SMTP()
server.connect(HOST,"25")
server.login(FROM,FROM_PASS)
server.sendmail(FROM,[TO],BODY)
server.quit()