在App Engine / Python中发送HTML电子邮件? [英] Send HTML e-mail in App Engine / Python?
本文介绍了在App Engine / Python中发送HTML电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我没有测试过,所以请原谅小虫子它基于Google文档中的示例:
http:/ /code.google.com/appengine/docs/python/mail/sendingmail.html
来自google.appengine .api import mail
message = mail.EmailMessage(sender =Example.com Support< support@example.com>,
subject =您的帐户已被批准)
message.to =Albert Johnson< Albert.Johnson@example.com&
message.body =
亲爱的阿尔伯特:
您的example.com帐户已获得批准,现在可以访问
http: /www.example.com/并使用您的Google帐户登录到
访问新功能
如果您有任何问题,请通知我们
example.com团队
message.html =
< html>< head>< / head>< body>
亲爱的阿尔伯特:
您的example.com帐户已获得批准,您现在可以访问
http://www.example.com/并使用您的Google帐户登录到
访问新功能
如果您有任何问题,请通知我们
example.com团队
< / body>< / html>
message.send()
Can you please give me a simple, and straightforward python example of sending an HTML e-mail using App Engine? Plaintext is straightforward, but I'm having difficulties with HTML tags.
解决方案
I haven't tested this, so please forgive any little bugs. It's based on an example from the Google documentation: http://code.google.com/appengine/docs/python/mail/sendingmail.html
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()
这篇关于在App Engine / Python中发送HTML电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文