码迷,mamicode.com
首页 > 其他好文 > 详细

基于SSL的邮件

时间:2018-01-10 11:45:55      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:header   span   python   blog   env   text   style   eve   server   

#!/usr/bin/env python3  
#coding: utf-8  
import smtplib  
from email.mime.text import MIMEText  
from email.header import Header  
sender = ‘***‘  
receiver = ‘***‘  
subject = ‘python email test‘  
smtpserver = ‘smtp.163.com‘  
username = ‘***‘  
password = ‘***‘  
  
msg = MIMEText(‘你好‘,‘text‘,‘utf-8‘)
msg[‘Subject‘] = Header(subject, ‘utf-8‘)  
  
smtp = smtplib.SMTP()  
smtp.connect(‘smtp.163.com‘)  
smtp.ehlo()  
smtp.starttls()  
smtp.ehlo()  
smtp.set_debuglevel(1)  
smtp.login(username, password)  
smtp.sendmail(sender, receiver, msg.as_string())  
smtp.quit()  

 

 

 

 

 

 

 

 

 

          

基于SSL的邮件

标签:header   span   python   blog   env   text   style   eve   server   

原文地址:https://www.cnblogs.com/pzk7788/p/8257052.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!