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.
Asked
Active
Viewed 1.4k times
3 Answers
54
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()

ʇsәɹoɈ
- 22,757
- 7
- 55
- 61
-
If I want to send email to multiple receipients, the docs say it should be a list of strings. Is it like this ['user1@example.com','user2@example2.com']? It doesn't seem to work for me. Is the format correct? – kassold May 21 '14 at 09:05
4
See this document. This is what you wanted. http://code.google.com/appengine/docs/python/mail/emailmessagefields.html
html field of a email message. An HTML version of the body content, for recipients that prefer HTML email.
attachments field for email attachments.

Rockystech
- 3,016
- 2
- 16
- 10
0
This details some issues with sending HTML email on App Engine: http://code.google.com/p/googleappengine/issues/detail?id=965

Bill Zeller
- 1,336
- 1
- 9
- 13
-
Not really caring about attachments, or images. Just basic HTML functionality, like
, etc – Silver Dragon May 18 '10 at 20:29