在python中怎么生成html格式的邮件并发送
2个回答
展开全部
请将代码中的email和密码替换成您的email和密码。
# -*- coding: cp936 -*-
import smtplib
msg = """From: From xxx
To: To UESEO <xxx>
MIME-Version: 1.0
Content-type: text/html
Subject: SMTP HTML e-mail test
This is an e-mail message to be sent in HTML format
<b>This is HTML message.</b>
<h1>This is headline.</h1>
<h2>sdfsdfdsf</h2>
"""
server = smtplib.SMTP('xxx',587) #port 465 or 587
server.ehlo()
server.starttls()
server.ehlo()
server.login('xxx','XXXXXX')#请替换成您的email和密码
server.sendmail('xxx','xxxg',msg)
server.close()
# -*- coding: cp936 -*-
import smtplib
msg = """From: From xxx
To: To UESEO <xxx>
MIME-Version: 1.0
Content-type: text/html
Subject: SMTP HTML e-mail test
This is an e-mail message to be sent in HTML format
<b>This is HTML message.</b>
<h1>This is headline.</h1>
<h2>sdfsdfdsf</h2>
"""
server = smtplib.SMTP('xxx',587) #port 465 or 587
server.ehlo()
server.starttls()
server.ehlo()
server.login('xxx','XXXXXX')#请替换成您的email和密码
server.sendmail('xxx','xxxg',msg)
server.close()
2017-08-17
展开全部
请将代码中的email和密码替换成您的email和密码。 # -*- coding: cp936 -*- import smtplib msg = """From: From xxx To: To UESEO <xxx>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询