Django 一次发送多封主题和正文不同的电子邮件

Django send multiple emails with difference subject, body at once

我想向我的客户发送调查,所以我希望每封电子邮件的主题、正文都包含客户的姓名。 是否可以一次发送所有电子邮件,或者我必须多次发送电子邮件,每次通过 SMTP 为特定客户发送电子邮件?

您可以使用 send_mass_mail()

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)

https://docs.djangoproject.com/en/1.8/topics/email/#send-mass-mail

SMTP 接受一封可能发给多个收件人的邮件。假设您以前使用过密件抄送,那可能是一条消息。

如果您要自定义电子邮件的主题或正文;必须有多个 mail() 调用和多个 SMTP 调用