diff options
author | Peter Poeml <poeml@suse.de> | 2006-06-16 09:22:47 +0000 |
---|---|---|
committer | Peter Poeml <poeml@suse.de> | 2006-06-16 09:22:47 +0000 |
commit | 07aca153f6187ae17028075a87b32e2f38d560d2 (patch) | |
tree | e3cedb5754e7baee8b544fad892bcc4fd7a5e16d | |
parent | a91b2064cb7acf9c488e02a0c5e1e8c3dfe38787 (diff) | |
download | archivemail-07aca153f6187ae17028075a87b32e2f38d560d2.tar.gz archivemail-07aca153f6187ae17028075a87b32e2f38d560d2.tar.bz2 archivemail-07aca153f6187ae17028075a87b32e2f38d560d2.zip |
- fix last patch: don't fail if server URL doesn't contain username of password; try plain as well as cram-md5 login
-rwxr-xr-x | archivemail.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/archivemail.py b/archivemail.py index a725ed4..cee8a9f 100755 --- a/archivemail.py +++ b/archivemail.py @@ -1226,12 +1226,11 @@ def _archive_imap(mailbox_name, final_archive_name): filter = build_imap_filter() vprint("imap filter: '%s'" % filter) try: + imap_server, imap_folder = imap_str.split('/', 1) imap_username, imap_str = imap_str.split(':', 1) imap_password, imap_str = imap_str.split('@', 1) - imap_server, imap_folder = imap_str.split('/', 1) except: - unexpected_error("you must provide a properly formatted \ - IMAP connection string") + pass imap_username = getpass.getuser() if options.pwfile: imap_password = open(options.pwfile).read().rstrip() @@ -1245,10 +1244,9 @@ def _archive_imap(mailbox_name, final_archive_name): else: imap_srv = imaplib.IMAP4(imap_server) vprint("connected to server %s" % imap_server) - cram_md5 = True - if cram_md5: + try: result, response = imap_srv.login_cram_md5(imap_username, imap_password) - else: + except: result, response = imap_srv.login(imap_username, imap_password) if result != 'OK': unexpected_error("authentication failure") vprint("logged in to server as %s" % imap_username) |