python 利用smtp发送文本邮件
2015-01-07 18:37
633 查看
废话不多说,直接贴代码
#!/usr/bin/python import smtplib from email.mime.text import MIMEText from email.header import Header sender = 'xxxx@yyy.com' receiver = 'zzzzz@qq.com' username = 'login_user' password = 'login_passwd' def sendMail(content,subject): msg = MIMEText(content,_subtype='plain',_charset='gb2312') msg['Subject'] = Header(subject, 'utf-8') smtp = smtplib.SMTP() #smtp.set_debuglevel(1) smtp.connect('smtp.your.com','587') smtp.starttls() smtp.login(username,password) smtp.sendmail(sender, receiver, msg.as_string()) smtp.quit() sendMail("this is a python send email test","hello python")
相关文章推荐
- (Python)利用SMTP发送邮件基础篇,发送文本邮件
- Python smtplib发送邮件 包含文本、附件、图片等
- Python smtplib发送邮件 包含文本、附件、图片
- python利用smtplib和MIMETYPE发送邮件
- python 2.7 利用smtplib发送、抄送邮件以及发送html表格
- Python利用SMTP发送邮件
- python:利用smtplib模块发送邮件
- python 利用smtp发送邮件,html格式
- (Python)利用SMTP发送邮件终极篇,主送、抄送、暗送
- python:利用smtplib模块发送邮件
- Python模块探秘之smtplib,实现纯文本邮件的发送
- Python利用SMTP发送邮件
- Python3利用SMTP发送邮件
- python3利用smtplib通过qq邮箱发送邮件方法示例
- 【转载】python中利用smtplib发送邮件的3中方式 普通/ssl/tls
- python3使用SMTP发送简单文本邮件
- (Python)利用SMTP发送邮件进阶篇,发送混合格式邮件
- python利用网易smtp服务发送邮件
- Python模块探秘之一:smtplib,实现纯文本邮件的发送
- Python Code: 利用QQ邮箱发送邮件,解决SMTPAuthenticationError:530错误