To send an email message, you call the API of the Mail service. The outgoing message has a sender address (“From”), one or more recipients (“To”, “Cc”, or “Bcc”), a subject, a message body, and optional file attachments.
A outgoing message can have only these fields, and cannot use other email message headers. The Mail service attaches additional headers to the message for tracking purposes, such as the date and time the message is sent.
You can specify a multipart message body, such as to include both plain text and HTML versions of the message, and to include attachments. The total size of the message, including all headers, cannot exceed one megabyte.
The call to the Mail service is asynchronous. When your application calls the Mail service to send a message, the message is enqueued for delivery, and the service call returns. If there is a problem delivering the message, such as if the remote mail server cannot be contacted or the remote server says the address is invalid, an error message is sent via email to the sender address. The app is not notified of the failure by the service directly. (You can use an incoming email address for the app as the sender address. The app will have to parse the message sent by the remote server for an error.)
When your app runs in the development server, sending a message causes the server to print information about the message to the logs, and no message is sent. In the Python development server only, you can configure the ...