package documentation

Tools for sending email.
Package backends No package docstring; 6/6 modules documented
Module message No module docstring; 0/2 variable, 0/2 constant, 1/1 function, 0/2 class documented
Module utils Email message and email sending related helper functions.

From __init__.py:

Class ​Email​Message A container for email information.
Function get​_connection Load an email backend and return an instance of it.
Function mail​_admins Send a message to the admins, as defined by the ADMINS setting.
Function mail​_managers Send a message to the managers, as defined by the MANAGERS setting.
Function send​_mail Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the 'To' field.
Function send​_mass​_mail Given a datatuple of (subject, message, from_email, recipient_list), send each message to each recipient list. Return the number of emails sent.
Constant DEFAULT​_ATTACHMENT​_MIME​_TYPE Undocumented
Constant DNS​_NAME Undocumented
Class ​Bad​Header​Error Undocumented
Class ​Cached​Dns​Name Undocumented
Class ​Email​Multi​Alternatives A version of EmailMessage that makes it easy to send multipart/alternative messages. For example, including text and HTML versions of the text is made easier.
Class ​Safe​MIMEMultipart Undocumented
Class ​Safe​MIMEText Undocumented
Function forbid​_multi​_line​_headers Forbid multi-line headers to prevent header injection.
DEFAULT_ATTACHMENT_MIME_TYPE: str =

Undocumented

Value
'application/octet-stream'
def forbid_multi_line_headers(name, val, encoding):
Forbid multi-line headers to prevent header injection.
DNS_NAME =

Undocumented

Value
CachedDnsName()
def get_connection(backend=None, fail_silently=False, **kwds):

Load an email backend and return an instance of it.

If backend is None (default), use settings.EMAIL_BACKEND.

Both fail_silently and other keyword arguments are used in the constructor of the backend.

def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None, html_message=None):

Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the 'To' field.

If from_email is None, use the DEFAULT_FROM_EMAIL setting. If auth_user is None, use the EMAIL_HOST_USER setting. If auth_password is None, use the EMAIL_HOST_PASSWORD setting.

Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.

def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None, connection=None):

Given a datatuple of (subject, message, from_email, recipient_list), send each message to each recipient list. Return the number of emails sent.

If from_email is None, use the DEFAULT_FROM_EMAIL setting. If auth_user and auth_password are set, use them to log in. If auth_user is None, use the EMAIL_HOST_USER setting. If auth_password is None, use the EMAIL_HOST_PASSWORD setting.

Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.

def mail_admins(subject, message, fail_silently=False, connection=None, html_message=None):
Send a message to the admins, as defined by the ADMINS setting.
def mail_managers(subject, message, fail_silently=False, connection=None, html_message=None):
Send a message to the managers, as defined by the MANAGERS setting.