def get_message_plain_text(msg: Message):
    """
    Converts an HTML message to plain text.

    :param msg: A :class:`~flask_mail.Message`
    :return: The plain text message.
    """
    if msg.body:
        return msg.body

    if BeautifulSoup is None or not msg.html:
        return msg.html

    plain_text = '\n'.join(line.strip() for line in
                           BeautifulSoup(msg.html, 'lxml').text.splitlines())
    return re.sub(r'\n\n+', '\n\n', plain_text).strip()
def get_message_plain_text ( msg : Message ) : if msg . body : return msg . body if BeautifulSoup is None or not msg . html : return msg . html plain_text = '\n' . join ( line . strip ( ) for line in BeautifulSoup ( msg . html , 'lxml' ) . text . splitlines ( ) ) return re . sub ( r'\n\n+' , '\n\n' , plain_text ) . strip ( )
Converts an HTML message to plain text.

    :param msg: A :class:`~flask_mail.Message`
    :return: The plain text message.