send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None, html_message=None) [source]
The simplest way to send email is using django.core.mail.send_mail().
The subject, message, from_email and recipient_list parameters are required.
-
subject: A string. -
message: A string. -
from_email: A string. -
recipient_list: A list of strings, each an email address. Each member ofrecipient_listwill see the other recipients in the “To:” field of the email message. -
fail_silently: A boolean. If it’sFalse,send_mailwill raise ansmtplib.SMTPException. See thesmtplibdocs for a list of possible exceptions, all of which are subclasses ofSMTPException. -
auth_user: The optional username to use to authenticate to the SMTP server. If this isn’t provided, Django will use the value of theEMAIL_HOST_USERsetting. -
auth_password: The optional password to use to authenticate to the SMTP server. If this isn’t provided, Django will use the value of theEMAIL_HOST_PASSWORDsetting. -
connection: The optional email backend to use to send the mail. If unspecified, an instance of the default backend will be used. See the documentation on Email backends for more details. -
html_message: Ifhtml_messageis provided, the resulting email will be a multipart/alternative email withmessageas the text/plain content type andhtml_messageas the text/html content type.
The return value will be the number of successfully delivered messages (which can be 0 or 1 since it can only send one message).
Please login to continue.