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 CachedDnsName Undocumented
Class EmailMessage A container for email information.
Class EmailMultiAlternatives 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 SafeMIMEMultipart Undocumented
Class SafeMIMEText Undocumented
Exception BadHeaderError Undocumented
Function forbid_multi_line_headers Forbid multi-line headers to prevent header injection.
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
DEFAULT_ATTACHMENT_MIME_TYPE: str = (source)

Undocumented

Value
'application/octet-stream'
def forbid_multi_line_headers(name, val, encoding): (source)

Forbid multi-line headers to prevent header injection.

DNS_NAME = (source)

Undocumented

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

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): (source)

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): (source)

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): (source)

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): (source)

Send a message to the managers, as defined by the MANAGERS setting.