Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; password - mailbox password. NB: mailbox is locked by server from here to 'quit()'
(self, user, password)
| 329 | timestamp = re.compile(br'\+OK.[^<]*(<.*>)') |
| 330 | |
| 331 | def apop(self, user, password): |
| 332 | """Authorisation |
| 333 | |
| 334 | - only possible if server has supplied a timestamp in initial greeting. |
| 335 | |
| 336 | Args: |
| 337 | user - mailbox user; |
| 338 | password - mailbox password. |
| 339 | |
| 340 | NB: mailbox is locked by server from here to 'quit()' |
| 341 | """ |
| 342 | secret = bytes(password, self.encoding) |
| 343 | m = self.timestamp.match(self.welcome) |
| 344 | if not m: |
| 345 | raise error_proto('-ERR APOP not supported by server') |
| 346 | import hashlib |
| 347 | digest = m.group(1)+secret |
| 348 | digest = hashlib.md5(digest).hexdigest() |
| 349 | return self._shortcmd('APOP %s %s' % (user, digest)) |
| 350 | |
| 351 | |
| 352 | def top(self, which, howmuch): |