OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

Unsafe login with 163 emails #696

Closed xianwenchen closed 3 years ago

xianwenchen commented 3 years ago

General informations

Configuration file offlineimaprc

[Account foo@163.com]
remoterepository = foo@163.com_remote
localrepository = foo@163.com_local

[Repository foo@163.com_local]
type = Maildir
localfolders = ~/foo/bar

[Repository foo@163.com_remote]
type = IMAP
remotehost = imap.163.com
remoteuser = foo
remotepass = bar
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
maxconnections = 1
readonly = True
sync_deletes = no

Logs, error

Account sync foo@163.com:
 *** Processing account foo@163.com
 Establishing connection to imap.163.com:993 (foo@163.com_remote)
Folder &dcVr0mWHTvZZOQ- [acc: foo@163.com]:
 Syncing &dcVr0mWHTvZZOQ-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&dcVr0mWHTvZZOQ-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&dcVr0mWHTvZZOQ-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &g0l6P3ux- [acc: foo@163.com]:
 Syncing &g0l6P3ux-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&g0l6P3ux-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&g0l6P3ux-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &i6KWBZCuTvY- [acc: foo@163.com]:
 Syncing &i6KWBZCuTvY-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&i6KWBZCuTvY-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&i6KWBZCuTvY-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &V4NXPpCuTvY- [acc: foo@163.com]:
 Syncing &V4NXPpCuTvY-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&V4NXPpCuTvY-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&V4NXPpCuTvY-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &XfJSIJZk- [acc: foo@163.com]:
 Syncing &XfJSIJZk-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&XfJSIJZk-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&XfJSIJZk-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &XfJT0ZAB- [acc: foo@163.com]:
 Syncing &XfJT0ZAB-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&XfJT0ZAB-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&XfJT0ZAB-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder &Xn9USpCuTvY- [acc: foo@163.com]:
 Syncing &Xn9USpCuTvY-: IMAP -> Maildir
 ERROR: Aborting sync, folder '&Xn9USpCuTvY-' [acc: 'foo@163.com']
  Error SELECTing mailbox '&Xn9USpCuTvY-', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder Archives [acc: foo@163.com]:
 Syncing Archives: IMAP -> Maildir
 ERROR: Aborting sync, folder 'Archives' [acc: 'foo@163.com']
  Error SELECTing mailbox 'Archives', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder INBOX [acc: foo@163.com]:
 Syncing INBOX: IMAP -> Maildir
 ERROR: Aborting sync, folder 'INBOX' [acc: 'foo@163.com']
  Error SELECTing mailbox 'INBOX', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])
Folder Notes [acc: foo@163.com]:
 Syncing Notes: IMAP -> Maildir
 ERROR: Aborting sync, folder 'Notes' [acc: 'foo@163.com']
  Error SELECTing mailbox 'Notes', server reply:
('NO', ['SELECT Unsafe Login. Please contact kefu@188.com for help'])

Steps to reproduce the error

Solution to the error

The IMAP server at imap.163.com implemented the IMAP ID extension. To successfully authenticate, the IMAP client must send client ID.

Here is a code snippet that I obtained from https://blog.yrpang.com/posts/45207/:

from imapclient import IMAPClient

server = IMAPClient("imap.163.com", ssl=True, port=993)
server.login("<user>", "<passwd>")

server.id_({"name": "IMAPClient", "version": "2.1.0"})

messages = server.select_folder('INBOX')

I guess this may mean that we need a configuration option that is a switch. When the switch is on, offlineimap sends IMAP client ID.

I'm going to open a similar issue on offlineimap3.

nicolas33 commented 3 years ago

You're correct I guess.

Due to the python2 end-of-life, we won't implement new features here. offlineimap3 is the correct project to make this request.