aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2008-02-14 22:19:34 +0000
committerNikolaus Schulz <microschulz@web.de>2008-02-14 22:19:34 +0000
commit533628c2fced445063d68fd05578ed05ce7ac05e (patch)
tree87a8d838b39023c818b336554386226d0af4d160 /archivemail.py
parent1fcd5b7292f2c3a6dd93c9c3223ec0d309b4d9cc (diff)
downloadarchivemail-533628c2fced445063d68fd05578ed05ce7ac05e.tar.gz
archivemail-533628c2fced445063d68fd05578ed05ce7ac05e.tar.bz2
archivemail-533628c2fced445063d68fd05578ed05ce7ac05e.zip
Only try CRAM-MD5 authentication if the server advertises it.
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/archivemail.py b/archivemail.py
index 98644bf..37edbb7 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -1353,10 +1353,12 @@ def _archive_imap(mailbox_name, final_archive_name):
else:
vprint("establishing connection to server %s" % imap_server)
imap_srv = imaplib.IMAP4(imap_server)
- vprint("logging in to server as %s" % imap_username)
- try:
+ # What about having an option that makes archivemail never try cram-md5?
+ if "AUTH=CRAM-MD5" in imap_srv.capabilities:
+ vprint("authenticating (cram-md5) to server as %s" % imap_username)
result, response = imap_srv.login_cram_md5(imap_username, imap_password)
- except imaplib.IMAP4.error:
+ else:
+ vprint("logging in to server as %s" % imap_username)
result, response = imap_srv.login(imap_username, imap_password)
roflag = options.dry_run or options.copy_old_mail