예제 #1
0
 def setUp(self):
     super(TestImapArchivedTransport, self).setUp()
     self.archive = 'Archive'
     self.transport = ImapTransport(self.arbitrary_hostname,
                                    self.arbitrary_port, self.ssl,
                                    self.archive)
     self.transport.server = self.imap_server
예제 #2
0
 def setUp(self):
     super(TestImapTransport, self).setUp()
     self.arbitrary_hostname = 'one.two.three'
     self.arbitrary_port = 100
     self.ssl = False
     self.transport = ImapTransport(self.arbitrary_hostname,
                                    self.arbitrary_port, self.ssl)
     self.transport.server = self.imap_server
예제 #3
0
    def setUp(self):
        super(TestMaxSizeImapTransport, self).setUp()

        self.transport = ImapTransport(
            self.arbitrary_hostname,
            self.arbitrary_port,
            self.ssl,
        )
        self.transport.server = self.imap_server
예제 #4
0
    def get_connection(self):
        """Returns the transport instance for this mailbox.

        These will always be instances of
        `django_mail_admin.transports.base.EmailTransport`.

        """
        if not self.uri:
            return None
        elif self.type == 'imap':
            conn = ImapTransport(
                self.location,
                port=self.port if self.port else None,
                ssl=self.use_ssl,
                tls=self.use_tls,
                archive=self.archive,
                folder=self.folder
            )
            conn.connect(self.username, self.password)
        elif self.type == 'gmail':
            conn = GmailImapTransport(
                self.location,
                port=self.port if self.port else None,
                ssl=True,
                archive=self.archive
            )
            conn.connect(self.username, self.password)
        elif self.type == 'pop3':
            conn = Pop3Transport(
                self.location,
                port=self.port if self.port else None,
                ssl=self.use_ssl
            )
            conn.connect(self.username, self.password)
        elif self.type == 'maildir':
            conn = MaildirTransport(self.location)
        elif self.type == 'mbox':
            conn = MboxTransport(self.location)
        elif self.type == 'babyl':
            conn = BabylTransport(self.location)
        elif self.type == 'mh':
            conn = MHTransport(self.location)
        elif self.type == 'mmdf':
            conn = MMDFTransport(self.location)
        return conn