Skip to main content

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. If from_email is None, use the DEFAULT_FROM_EMAIL 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: tuple,
fail_silently: boolean = False,
auth_user: string = None,
auth_password: string = None,
connection: object = None,
using: string = None
) - > int

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

Parameters

NameTypeDescription
datatupletupleAn iterable of tuples, where each tuple contains (subject, message, from_email, recipient_list) for an individual email.
fail_silentlyboolean = FalseA boolean that, when True, suppresses exceptions raised during the mail sending process.
auth_userstring = NoneThe username to use for authenticating with the SMTP server.
auth_passwordstring = NoneThe password to use for authenticating with the SMTP server.
connectionobject = NoneAn optional email backend instance to use for sending the mail.
usingstring = NoneThe alias of the email backend configuration to use as defined in settings.

Returns

TypeDescription
intThe total number of email messages successfully sent.