Exemple #1
0
    def __init__(self,
                 hostname,
                 username=None,
                 password=None,
                 ssl=True,
                 port=None,
                 ssl_context=None,
                 policy=None,
                 starttls=False,
                 vendor=None):

        self.server = ImapTransport(hostname,
                                    ssl=ssl,
                                    port=port,
                                    ssl_context=ssl_context,
                                    starttls=starttls)

        self.hostname = hostname
        self.username = username
        self.password = password
        self.parser_policy = policy
        self.vendor = vendor or hostname_vendorname_dict.get(self.hostname)

        if self.vendor is not None:
            self.authentication_error_message = name_authentication_string_dict.get(
                self.vendor)

        try:
            self.connection = self.server.connect(username, password)
        except imaplib.IMAP4.error as e:
            if self.authentication_error_message is None:
                raise
            raise imaplib.IMAP4.error(self.authentication_error_message +
                                      '\n' + str(e))
Exemple #2
0
    def __init__(self,
                 hostname,
                 username=None,
                 password=None,
                 ssl=True,
                 port=None,
                 ssl_context=None,
                 policy=None,
                 starttls=False):

        self.server = ImapTransport(hostname,
                                    ssl=ssl,
                                    port=port,
                                    ssl_context=ssl_context,
                                    starttls=starttls)
        self.hostname = hostname
        self.username = username
        self.password = password
        self.parser_policy = policy
        self.connection = self.server.connect(username, password)
        logger.info(
            "Connected to IMAP Server with user {username} on {hostname}{ssl}".
            format(hostname=hostname,
                   username=username,
                   ssl=(" over SSL" if ssl or starttls else "")))
Exemple #3
0
    def __init__(self, hostname, username=None, password=None, ssl=True):

        self.server = ImapTransport(hostname, ssl=ssl)
        self.hostname = hostname
        self.username = username
        self.password = password
        self.connection = self.server.connect(username, password)
        logger.info("Connected to IMAP Server with user {username} on {hostname}{ssl}".format(
            hostname=hostname, username=username, ssl=(" over SSL" if ssl else "")))
Exemple #4
0
    def __init__(self,
                 hostname,
                 username=None,
                 password=None,
                 ssl=True,
                 port=None,
                 ssl_context=None,
                 policy=None,
                 starttls=False,
                 vendor=None,
                 timeout_per_msg=None):

        self.server = ImapTransport(hostname,
                                    ssl=ssl,
                                    port=port,
                                    ssl_context=ssl_context,
                                    starttls=starttls)

        self.hostname = hostname
        self.username = username
        self.password = password
        self.parser_policy = policy
        self.timeout_per_msg = timeout_per_msg
        self.vendor = vendor or hostname_vendorname_dict.get(self.hostname)

        if self.vendor is not None:
            self.authentication_error_message = name_authentication_string_dict.get(
                self.vendor)

        try:
            self.connection = self.server.connect(username, password)
        except imaplib.IMAP4.error as e:
            if self.authentication_error_message is None:
                raise
            raise imaplib.IMAP4.error(self.authentication_error_message +
                                      '\n' + str(e))

        logger.info(
            "Connected to IMAP Server with user {username} on {hostname}{ssl}".
            format(hostname=hostname,
                   username=username,
                   ssl=(" over SSL" if ssl or starttls else "")))
Exemple #5
0
    def __init__(self, hostname, username=None, password=None, ssl=True):

        self.server = ImapTransport(hostname, ssl=ssl)
        self.username = username
        self.password = password
        self.connection = self.server.connect(username, password)