smtp 发邮件
2015-06-01 10:48
615 查看
”’python
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
sender = ‘xxxxxxx@qq.com’
receivers = [‘2313248751@qq.com’]
msg=MIMEMultipart()
msg[“From”]=”power@power.com”
msg[“To”]=”you@yourself.com”
msg[“Subject”]=”Test smtp by s2”
text=MIMEText(“this is text content”)
msg.attach(text)
try:
smtp=smtplib.SMTP()
smtp.connect(“smtp.qq.com”)
smtp.login(‘xxxxxxx@qq.com’,”xxxx”)
smtp.sendmail(sender, receivers, msg.as_string())
print “Successfully sent email”
except :
print “Error: unable to send email”
”’
coding=utf-8
import smtplibfrom email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
sender = ‘xxxxxxx@qq.com’
receivers = [‘2313248751@qq.com’]
msg=MIMEMultipart()
msg[“From”]=”power@power.com”
msg[“To”]=”you@yourself.com”
msg[“Subject”]=”Test smtp by s2”
text=MIMEText(“this is text content”)
msg.attach(text)
try:
smtp=smtplib.SMTP()
smtp.connect(“smtp.qq.com”)
smtp.login(‘xxxxxxx@qq.com’,”xxxx”)
smtp.sendmail(sender, receivers, msg.as_string())
print “Successfully sent email”
except :
print “Error: unable to send email”
”’
相关文章推荐
- php不用正则验证真假身份证 身份证号码验证
- php 编译安装报错 configure: error: mcrypt.h not found. Please reinstall libmcrypt.
- php 函数
- Zend Studio 12 newPHP 模板及编码、和一些常见的问题在哪修改
- php用于URL的base64
- 《PHP内核探索系列文章》系列技术文章整理收藏
- 关于 PHP 7 你必须知道的五件事
- 支持php短格式
- php 连接mysql
- i春秋:揭秘FTP口令安全—利用“hscan”工具的测试
- PHP7和HHVM的性能之争
- Composer&laravel5安装笔记
- php计算整个目录大小的方法
- php从文件夹随机读取文件的方法
- php实现读取和写入tab分割的文件
- php正则preg_replace_callback函数用法实例
- php将字符串随机分割成不同长度数组的方法
- PHP学习笔记(二)
- htpasswd命令用法
- php中一个完整表单处理实现代码