首先列举下一些常用smtp服务器
#qq smtp.qq.com
#163 mtp.163.com
#gmail smtp.gmail.com#126 smtp.126.com
email发送程序
#!/usr/bin/python
#coding=utf-8
import smtplib
from email.mime.text import MIMEText
_user = "from@qq.com" #from
_pwd = "password" # password
_to = "to@qq.com" #to
#使用MIMEText构造符合smtp协议的header及body
msg = MIMEText('HaHa,This is a test')
msg["Subject"] = "This is the title"
msg["From"] = _user
msg["To"] = _to
s = smtplib.SMTP("smtp.qq.com", timeout=30)#连接smtp邮件服务器,端口默认是25
s.login(_user, _pwd)#登陆服务器
s.sendmail(_user, _to, msg.as_string())#发送邮件
s.close()
参考原文:http://blog.csdn.net/handsomekang/article/details/9785411
附一篇写的还不错的关于发送email的文章http://www.cnblogs.com/xiaowuyi/archive/2012/03/17/2404015.html