Package django :: Package core :: Module mail
[hide private]
[frames] | no frames]

Module mail

source code

Tools for sending email.

Classes [hide private]
  CachedDnsName
  BadHeaderError
  SafeMIMEText
  SafeMIMEMultipart
  SMTPConnection
A wrapper that manages the SMTP network connection.
  EmailMessage
A container for email information.
  EmailMultiAlternatives
A version of EmailMessage that makes it easy to send multipart/alternative messages.
Functions [hide private]
 
make_msgid(idstring=None)
Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
source code
 
send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None)
Easy wrapper for sending a single message to a recipient list.
source code
 
send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None)
Given a datatuple of (subject, message, from_email, recipient_list), sends each message to each recipient list.
source code
 
mail_admins(subject, message, fail_silently=False)
Sends a message to the admins, as defined by the ADMINS setting.
source code
 
mail_managers(subject, message, fail_silently=False)
Sends a message to the managers, as defined by the MANAGERS setting.
source code
Variables [hide private]
  DEFAULT_ATTACHMENT_MIME_TYPE = 'application/octet-stream'
  DNS_NAME = CachedDnsName()

Imports: settings, smart_str, force_unicode, Charset, Encoders, MIMEText, MIMEMultipart, MIMEBase, Header, formatdate, parseaddr, formataddr, mimetypes, os, smtplib, socket, time, random


Function Details [hide private]

make_msgid(idstring=None)

source code 

Returns a string suitable for RFC 2822 compliant Message-ID, e.g:

<20020201195627.33539.96671@nightshade.la.mastaler.com>

Optional idstring if given is a string used to strengthen the uniqueness of the message id.

send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None)

source code 

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 auth_user is None, the EMAIL_HOST_USER setting is used. If auth_password is None, the EMAIL_HOST_PASSWORD setting is used.

NOTE: This method is deprecated. It exists for backwards compatibility. New code should use the EmailMessage class directly.

send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None)

source code 

Given a datatuple of (subject, message, from_email, recipient_list), sends each message to each recipient list. Returns the number of e-mails sent.

If from_email is None, the DEFAULT_FROM_EMAIL setting is used. If auth_user and auth_password are set, they're used to log in. If auth_user is None, the EMAIL_HOST_USER setting is used. If auth_password is None, the EMAIL_HOST_PASSWORD setting is used.

NOTE: This method is deprecated. It exists for backwards compatibility. New code should use the EmailMessage class directly.