def send_mail_with_backend(
subject, body, from_email, recipient_list, html_message=None,
fail_silently=False, auth_user=None, auth_password=None,
attachments=None, alternatives=None, connection=None, headers=None,
do_not_encrypt_this_message=False):
connection = connection or mail.get_connection(
username=auth_user, password=auth_password,
fail_silently=fail_silently,
)
message = mail.EmailMultiAlternatives(
subject, body, from_email, recipient_list, attachments=attachments,
connection=connection, headers=headers)
if html_message:
message.attach_alternative(html_message, 'text/html')
for alternative, mimetype in alternatives or []:
message.attach_alternative(alternative, mimetype)
if do_not_encrypt_this_message:
message.do_not_encrypt_this_message = True
return message.send()
评论列表
文章目录