Mercurial > p > roundup > code
diff roundup/mailgw.py @ 3779:ee73abcc95d2
Sorry, another mega-patch:
- clarified windows service documentation (patch [SF#1597713])
- HTMLClass fixed to work with new item permissions check [SF#1602983]
- support POP over SSL (patch [SF#1597703])
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 13 Dec 2006 23:32:39 +0000 |
| parents | b4d655b2aacf |
| children | 63288c1e45b6 |
line wrap: on
line diff
--- a/roundup/mailgw.py Tue Dec 12 05:15:44 2006 +0000 +++ b/roundup/mailgw.py Wed Dec 13 23:32:39 2006 +0000 @@ -72,7 +72,7 @@ an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.178 2006-10-05 23:08:20 richard Exp $ +$Id: mailgw.py,v 1.179 2006-12-13 23:32:38 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -428,12 +428,17 @@ return 0 - def do_apop(self, server, user='', password=''): + def do_apop(self, server, user='', password='', ssl=False): ''' Do authentication POP ''' - self.do_pop(server, user, password, apop=1) + self._do_pop(server, user, password, True, ssl) - def do_pop(self, server, user='', password='', apop=0): + def do_pop(self, server, user='', password='', ssl=False): + ''' Do plain POP + ''' + self._do_pop(server, user, password, False, ssl) + + def _do_pop(self, server, user, password, apop, ssl): '''Read a series of messages from the specified POP server. ''' import getpass, poplib, socket @@ -449,7 +454,11 @@ # open a connection to the server and retrieve all messages try: - server = poplib.POP3(server) + if ssl: + klass = poplib.POP3_SSL + else: + klass = poplib.POP3 + server = klass(server) except socket.error: self.logger.exception('POP server error') return 1
