Sending e-mails
Sending e-mails in Google App Engine is pretty simple. We have two options if we want to send e-mails:
Use the
send_mail()
function fromgoogle.appengine.api.mail
Use
EmailMessage
from the same module
While sending an e-mail you need some information, such as the recipient of the e-mail, the subject of the e-mail, the contents of the message, and so on. All of this can be supplied via keyword arguments.
The following keyword arguments can be supplied while calling the send_mail()
function and are equally applicable for the EmailMessage
class's constructor:
sender
: This is theFrom
field. There are some restrictions on it. We'll take a look at this later.to
: This is the address of the recipient of the e-mail. This can be a Python list of e-mail addresses as well.cc
: This is the address of the recipient who gets a copy of the e-mail. It can be a string or a list of strings for multiple e-mail addresses. It is an abbreviation for carbon copy.bcc
: This is the address of those...