class documentation

class EmailMessage:

Known subclasses: django.core.mail.EmailMultiAlternatives

View In Hierarchy

A container for email information.
Method __init__ Initialize a single email message (which can be sent to multiple recipients).
Method ​_create​_attachment Convert the filename, content, mimetype triple into a MIME attachment object.
Method ​_create​_attachments Undocumented
Method ​_create​_message Undocumented
Method ​_create​_mime​_attachment Convert the content, mimetype pair into a MIME attachment object.
Method ​_set​_list​_header​_if​_not​_empty Set msg's header, either from self.extra_headers, if present, or from the values argument.
Method attach Attach a file with the given filename and content. The filename can be omitted and the mimetype is guessed, if not provided.
Method attach​_file Attach a file from the filesystem.
Method get​_connection Undocumented
Method message Undocumented
Method recipients Return a list of all recipients of the email (includes direct addressees as well as Cc and Bcc entries).
Method send Send the email message.
Class Variable content​_subtype Undocumented
Class Variable encoding Undocumented
Class Variable mixed​_subtype Undocumented
Instance Variable attachments Undocumented
Instance Variable bcc Undocumented
Instance Variable body Undocumented
Instance Variable cc Undocumented
Instance Variable connection Undocumented
Instance Variable extra​_headers Undocumented
Instance Variable from​_email Undocumented
Instance Variable reply​_to Undocumented
Instance Variable subject Undocumented
Instance Variable to Undocumented
def __init__(self, subject='', body='', from_email=None, to=None, bcc=None, connection=None, attachments=None, headers=None, cc=None, reply_to=None):
Initialize a single email message (which can be sent to multiple recipients).
def _create_attachment(self, filename, content, mimetype=None):
Convert the filename, content, mimetype triple into a MIME attachment object.
def _create_attachments(self, msg):

Undocumented

def _create_message(self, msg):

Undocumented

def _create_mime_attachment(self, content, mimetype):

Convert the content, mimetype pair into a MIME attachment object.

If the mimetype is message/rfc822, content may be an email.Message or EmailMessage object, as well as a str.

def _set_list_header_if_not_empty(self, msg, header, values):
Set msg's header, either from self.extra_headers, if present, or from the values argument.
def attach(self, filename=None, content=None, mimetype=None):

Attach a file with the given filename and content. The filename can be omitted and the mimetype is guessed, if not provided.

If the first parameter is a MIMEBase subclass, insert it directly into the resulting message attachments.

For a text/* mimetype (guessed or specified), when a bytes object is specified as content, decode it as UTF-8. If that fails, set the mimetype to DEFAULT_ATTACHMENT_MIME_TYPE and don't decode the content.

def attach_file(self, path, mimetype=None):

Attach a file from the filesystem.

Set the mimetype to DEFAULT_ATTACHMENT_MIME_TYPE if it isn't specified and cannot be guessed.

For a text/* mimetype (guessed or specified), decode the file's content as UTF-8. If that fails, set the mimetype to DEFAULT_ATTACHMENT_MIME_TYPE and don't decode the content.

def get_connection(self, fail_silently=False):

Undocumented

def message(self):

Undocumented

def recipients(self):
Return a list of all recipients of the email (includes direct addressees as well as Cc and Bcc entries).
def send(self, fail_silently=False):
Send the email message.
content_subtype: str =

Undocumented

encoding =

Undocumented

mixed_subtype: str =

Undocumented

attachments: list =

Undocumented

bcc =

Undocumented

body =

Undocumented

cc =

Undocumented

connection =

Undocumented

extra_headers =

Undocumented

from_email =

Undocumented

reply_to =

Undocumented

subject =

Undocumented

to =

Undocumented