def send_email_message ( self , recipient , subject , html_message , text_message , sender_email , sender_name ) : if not current_app . testing : # pragma: no cover # Prepare email message from flask_sendmail import Message message = Message ( subject , recipients = [ recipient ] , html = html_message , body = text_message ) # Send email message self . mail . send ( message )
send an email in python with flask
Send email message via Flask - Sendmail .
def send_email_message(self, recipient, subject, html_message, text_message, sender_email, sender_name):
        """ Send email message via Flask-Sendmail.

        Args:
            recipient: Email address or tuple of (Name, Email-address).
            subject: Subject line.
            html_message: The message body in HTML.
            text_message: The message body in plain text.
        """

        if not current_app.testing:  # pragma: no cover

            # Prepare email message
            from flask_sendmail import Message
            message = Message(
                subject,
                recipients=[recipient],
                html=html_message,
                body=text_message)

            # Send email message
            self.mail.send(message)