Python 3.10 is now available in preview.

google.appengine.api.mail.MailMessageToMIMEMessage

Generates a MIMEMultipart message from a MailMessage protocol buffer.

This function generates a complete MIMEMultipart email object from a MailMessage protocol buffer. The body fields are sent as individual alternatives if they are both present; otherwise, only one body part is sent.

Multiple entry email fields, such as 'To', 'Cc', and 'Bcc' are converted to a list of comma-separated email addresses.

protocol_message Message protocol buffer to convert to a MIMEMultipart message.

A MIMEMultipart message that represents the provided MailMessage.

InvalidAttachmentTypeError If the file type of the attachment is invalid.