python 发送邮件
当前位置:以往代写 > Python教程 >python 发送邮件
2019-06-14

python 发送邮件

python 发送邮件
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
        ),"\r\n")
server = smtplib.SMTP()
server.connect(HOST,"25")
server.login(FROM,FROM_PASS)
server.sendmail(FROM,[TO],BODY)
server.quit()

标签:python

    关键字:

在线提交作业