def send(self):
"""Sends the payment email along with the invoice."""
body = self.get_body()
# Set non-empty body according to
# http://stackoverflow.com/questions/14580176/confusion-with-sending-email-in-django
mail = EmailMultiAlternatives(subject=self.get_subject(),
body=strip_tags(body),
to=self.get_recipient_list(),
cc=self.get_cc_list(),
bcc=self.get_bcc_list())
mail.attach_alternative(body, 'text/html')
for attachment in self.attachments:
mail.attach_file(attachment[0], attachment[1])
return mail.send()
评论列表
文章目录