小编Far*_*oth的帖子

如何从Python发送AMP电子邮件?它在技术上与普通电子邮件有何不同

我试图了解什么是 AMP 电子邮件,并了解如何从 Pyhton/NodeJs/Ruby 等发送它。

目前在 Python 中我发送电子邮件如下:



import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

from = "from@email.address"
to = "to@email.address"

msg = MIMEMultipart('alternative')
msg['Subject'] = "AMP Email"
msg['From'] = from
msg['To'] = to

#Email body.
plain_text = "Hi,\nThis is the plain text version of this Email.\nHere is a link that is for testing:\nhttps://amp.dev/documentation/guides-and-tutorials/start/create_email/?format=email"
html_amp = """\
<html amp4email>
  <head>
  <meta charset="utf-8">
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <style amp4email-boilerplate>body{visibility:hidden}</style>
  <style amp-custom>
    h1 {
      margin: 1rem;
    }
  </style>
</head>
  <body> …
Run Code Online (Sandbox Code Playgroud)

python email amp-email

2
推荐指数
1
解决办法
813
查看次数

标签 统计

amp-email ×1

email ×1

python ×1