def send_email(subject, recipients, text_body, html_body, sender=""): if not sender: msg = Message(subject, recipients=recipients) else: msg = Message(subject, recipients=recipients, sender=sender) msg.body = text_body msg.html = html_body mail.send(msg)
def send_email(subject, recipients, text_body, html_body, sender=None): """Sends an email to the given recipients. :param subject: The subject of the email. :param recipients: A list of recipients. :param text_body: The text body of the email. :param html_body: The html body of the email. :param sender: A two-element tuple consisting of name and address. If no sender is given, it will fall back to the one you have configured with ``MAIL_DEFAULT_SENDER``. """ msg = Message(subject, recipients=recipients, sender=sender) msg.body = text_body msg.html = html_body mail.send(msg)
def send_async_email(msg): mail.send(msg)
def send_email(subject, recipients, text_body, html_body, sender=None): msg = Message(subject, recipients=recipients, sender=sender) msg.body = text_body msg.html = html_body mail.send(msg)