Allow mails without HTML

This commit is contained in:
Raphael Michel
2017-08-08 22:28:27 +02:00
parent a6c9fb0f8b
commit ca1b1032eb

View File

@@ -143,7 +143,8 @@ def mail(email: str, subject: str, template: Union[str, LazyI18nString],
def mail_send_task(to: List[str], subject: str, body: str, html: str, sender: str,
event: int=None, headers: dict=None) -> bool:
email = EmailMultiAlternatives(subject, body, sender, to=to, headers=headers)
email.attach_alternative(inline_css(html), "text/html")
if html is not None:
email.attach_alternative(inline_css(html), "text/html")
if event:
event = Event.objects.get(id=event)
backend = event.get_mail_backend()