在App Engine/Python中发送HTML电子邮件?
你能给我一个简单明了的python示例,用AppEngine发送HTML电子邮件吗?明文很简单,但我在使用HTML标记时遇到了困难。这详细说明了在App Engine上发送HTML电子邮件的一些问题:我还没有测试过这个,所以请原谅任何小错误。它基于谷歌文档中的一个示例:在App Engine/Python中发送HTML电子邮件?,python,google-app-engine,email,Python,Google App Engine,Email,你能给我一个简单明了的python示例,用AppEngine发送HTML电子邮件吗?明文很简单,但我在使用HTML标记时遇到了困难。这详细说明了在App Engine上发送HTML电子邮件的一些问题:我还没有测试过这个,所以请原谅任何小错误。它基于谷歌文档中的一个示例: 来自google.appengine.api导入邮件 message=mail.EmailMessage(sender=“Example.com Support”, 主题=“您的帐户已被批准”) message.to=“艾伯特
来自google.appengine.api导入邮件
message=mail.EmailMessage(sender=“Example.com Support”,
主题=“您的帐户已被批准”)
message.to=“艾伯特·约翰逊”
message.body=“”
亲爱的阿尔伯特:
您的example.com帐户已获得批准。您现在可以访问
http://www.example.com/ 并使用您的Google帐户登录以
访问新功能。
如果您有任何问题,请告诉我们。
example.com团队
"""
message.html=“”
亲爱的阿尔伯特:
您的example.com帐户已获得批准。您现在可以访问
http://www.example.com/ 并使用您的Google帐户登录以
访问新功能。
如果您有任何问题,请告诉我们。
example.com团队
"""
message.send()
参见本文档。这就是你想要的。
html电子邮件的字段。
正文内容的HTML版本,适用于喜欢HTML电子邮件的收件人。
附件用于电子邮件附件的字段。并不真正关心附件或图像。只是基本的HTML功能,比如
,etcIf我想向多个接收者发送电子邮件,文档说它应该是一个字符串列表。是这样的吗user1@example.com','user2@example2.com']? 这似乎对我不起作用。格式正确吗?
from google.appengine.api import mail
message = mail.EmailMessage(sender="Example.com Support <support@example.com>",
subject="Your account has been approved")
message.to = "Albert Johnson <Albert.Johnson@example.com>"
message.body = """
Dear Albert:
Your example.com account has been approved. You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
"""
message.html = """
<html><head></head><body>
Dear Albert:
Your example.com account has been approved. You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
</body></html>
"""
message.send()