相关文章推荐
阳刚的板凳  ·  [Python] [Django] ...·  1 年前    · 
小胡子的沙发  ·  GAUSS-00230:SELECT ...·  1 年前    · 
捣蛋的凉茶  ·  c# - How do you call ...·  1 年前    · 
至今单身的牛排  ·  django - python ...·  1 年前    · 

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.

Answers

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()
   
  • 浏览量 5
  • 收藏 0
  • 0

所有评论(0)