# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
-
-SUMMARY
-------------------------------------------------------
-Utilities for dealing with email
+Utilities for dealing with email.
.. seealso:: :py:mod:`pyi2ncommon.mail_validator`,
:py:mod:`pyi2ncommon.imap_mailbox`
Copyright: Intra2net AG
-
-
-INTERFACE
-------------------------------------------------------
-
"""
from base64 import b64decode
Removes the SMTP envelope surrounding the email if present. Only left-over
might be a line with a '.' at end of non-multipart messages if
- `headers_only` is False.
+ `headers_only` is False.
:param str file_name: path to the file that contains the email text
:param bool headers_only: whether to parse only the email headers; set this
continue
...
- Finds the first part in message that is of type text/plain and decodes it
+ Finds the first part in message that is of type `text/plain` and decodes it
using encoding specified in mail or otherwise fallback encoding. If none
- found takes first part of type "text/*", or otherwise just the first part.
+ found takes first part of type `text/*`, or otherwise just the first part.
- If include_all_text is True, all text/* parts are included, with text/plain
+ If include_all_text is True, all `text/*` parts are included, with `text/plain`
being the first.
:param str filename: complete path of message file in filesystem
:param str fallback_encoding: Encoding of email text if none is specified
in mail.
- :param bool include_all_text: include all "text/*" parts in returned text
+ :param bool include_all_text: include all `text/*` parts in returned text
:returns: text(s) of message
:rtype: [str] if include_all_text else str
"""