(imap, uid, append_to=None, logger=None)
return mail
Get a message by *uid* and optionally append it to a list.

    Args:
        imap (IsbgImap4): The imap helper object with the connection.
        uid (:obj:`int` or :obj:`str`): A integer value with the *uid* of a
            message to fetch from the *imap* connection.
        append_to (:obj:`list` of :obj:`int`), optional): The integer value of
            *uid* is appended to this list. Defaults to *None*.
        logger (logging.Logger, optional): When a error is raised fetching the
            mail a warning is written to this logger. Defaults to *None*.

    Returns:
        email.message.Message: The message fetched from the *imap* connection.
Get a message by *uid* and optionally append it to a list.
Get a message by * uid * and optionally append it to a list .
def get_message(imap, uid, append_to=None, logger=None):
    # type: (IsbgImap4, Uid, Optional[Uids], Optional[logging.Logger]) -> Email
    """Get a message by *uid* and optionally append it to a list.

    Args:
        imap (IsbgImap4): The imap helper object with the connection.
        uid (:obj:`int` or :obj:`str`): A integer value with the *uid* of a
            message to fetch from the *imap* connection.
        append_to (:obj:`list` of :obj:`int`), optional): The integer value of
            *uid* is appended to this list. Defaults to *None*.
        logger (logging.Logger, optional): When a error is raised fetching the
            mail a warning is written to this logger. Defaults to *None*.

    Returns:
        email.message.Message: The message fetched from the *imap* connection.

    """
    res = imap.uid("FETCH", uid, "(BODY.PEEK[])")
    mail = email.message.Message()  # an empty email
    if res[0] != "OK":
        try:
            body = res[1][0][1]
            mail = new_message(body)
        except Exception:  # pylint: disable=broad-except
            logger.warning(__(
                ("Confused - rfc822 fetch gave {} - The message was " +
                 "probably deleted while we were running").format(res)))
    else:
        body = res[1][0][1]
        mail = new_message(body)

    if append_to is not None:
        append_to.append(int(uid))

    return mail
def get_message ( imap , uid , append_to = None , logger = None ) : # type: (IsbgImap4, Uid, Optional[Uids], Optional[logging.Logger]) -> Email res = imap . uid ( "FETCH" , uid , "(BODY.PEEK[])" ) mail = email . message . Message ( ) # an empty email if res [ 0 ] != "OK" : try : body = res [ 1 ] [ 0 ] [ 1 ] mail = new_message ( body ) except Exception : # pylint: disable=broad-except logger . warning ( __ ( ( "Confused - rfc822 fetch gave {} - The message was " + "probably deleted while we were running" ) . format ( res ) ) ) else : body = res [ 1 ] [ 0 ] [ 1 ] mail = new_message ( body ) if append_to is not None : append_to . append ( int ( uid ) ) return mail