send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None, connection=None)
[source]
django.core.mail.send_mass_mail()
is intended to handle mass emailing.
datatuple
is a tuple in which each element is in this format:
1 | (subject, message, from_email, recipient_list) |
fail_silently
, auth_user
and auth_password
have the same functions as in send_mail()
.
Each separate element of datatuple
results in a separate email message. As in send_mail()
, recipients in the same recipient_list
will all see the other addresses in the email messages’ “To:” field.
For example, the following code would send two different messages to two different sets of recipients; however, only one connection to the mail server would be opened:
1 2 3 | message1 = ( 'Subject here' , 'Here is the message' , 'from@example.com' , [ 'first@example.com' , 'other@example.com' ]) message2 = ( 'Another Subject' , 'Here is another message' , 'from@example.com' , [ 'second@test.com' ]) send_mass_mail((message1, message2), fail_silently = False ) |
The return value will be the number of successfully delivered messages.
Please login to continue.