python login 163 mail server

2024/11/20 7:11:43

When I use this script to login the 163 mail server,there is something wrong! My python env is python 2.7.8 Please help me!

import imaplibdef open_connect(verbose=False):host = 'imap.163.com'port = 993if verbose:print 'Connecting to',hostconnection = imaplib.IMAP4_SSL(host)username = '[email protected]'passwd = 'aaannnmmm'if verbose:print 'Logging in as',usernametry:connection.login(username,passwd)except Exception as err:print 'ERROR:', errreturn connectionc = open_connect()try:tye,data = c.select('INBOX')print tye,datanum_msgs=int(data[0])print 'There are %d messages in INBOX' % num_msgs
finally:c.close()c.logout()

=====

NO ['SELECT The login is not safe! Please update your mail client: http://mail.163.com/dashi']
Traceback (most recent call last):File "imap_select.py", line 26, in <module>c.close()File "/usr/lib/python2.7/imaplib.py", line 382, in closetyp, dat = self._simple_command('CLOSE')File "/usr/lib/python2.7/imaplib.py", line 1070, in _simple_commandreturn self._command_complete(name, self._command(name, *args))File "/usr/lib/python2.7/imaplib.py", line 825, in _command', '.join(Commands[name])))
imaplib.error: command CLOSE illegal in state AUTH, only allowed in states SELECTED

===== And then the 163 mail server send me a mail,about this:

该行为存在以下安全隐患:
1) 邮件客户端未经有效识别,不能有效保证帐户安全性,存在帐号密码泄漏的风险;
2) 数据传输安全性低,存在数据泄漏风险。

In English is :

1) mail client not a security client 
2) data streaming is notsecruity

Thanks a lot. This is the debug info . I think that I must a have a TLS1.2 version conection.

  05:59.52 > ENFK1 LOGIN "[email protected]" "aaannnmmm"05:59.54 < ENFK1 OK LOGIN completed05:59.54      matched r'(?P<tag>ENFK\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('ENFK1', 'OK', 'LOGIN completed')05:59.54 > ENFK2 SELECT INBOX05:59.54 < ENFK2 NO SELECT The login is not safe! Please update your mail client: http://mail.163.com/dashi05:59.54      matched r'(?P<tag>ENFK\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('ENFK2', 'NO', 'SELECT The login is not safe! Please update your mail client: http://mail.163.com/dashi')05:59.54 NO response: SELECT The login is not safe! Please update your mail client: http://mail.163.com/dashi
NO ['SELECT The login is not safe! Please update your mail client: http://mail.163.com/dashi']
Traceback (most recent call last):File "imapselect.py", line 31, in <module>c.close()File "/usr/lib64/python2.6/imaplib.py", line 375, in closetyp, dat = self._simple_command('CLOSE')File "/usr/lib64/python2.6/imaplib.py", line 1060, in _simple_commandreturn self._command_complete(name, self._command(name, *args))File "/usr/lib64/python2.6/imaplib.py", line 818, in _command', '.join(Commands[name])))
imaplib.error: command CLOSE illegal in state AUTH, only allowed in states SELECTED
Answer

After netease blocking your own client, they will send you an email named 网易邮箱提醒:阻止了一次不安全的收信请求 by [email protected].

On the bottom of the email, they provided a link to the configure page:

http://config.mail.163.com/settings/imap/[email protected]

Replace YOUR_EMAIL_NAME by yourself.

https://en.xdnf.cn/q/119860.html

Related Q&A

How to get list of keys that share a value with another key within the same dictionary?

I have a dictionary of unique keys where some keys share the same value. For example:D = {ida:{key:1},idb:{key:2},idc:{key:3},idd:{key:3},ide:{key:4},idf:{key:4},idg:{key:4}}I want a list of keys that…

Sqlite3 Error: near question mark: syntax error [duplicate]

This question already has answers here:Parameterized query binding table name as parameter gives error(3 answers)How to use variables in SQL statement in Python?(5 answers)Closed last year.I am trying…

running bs4 scraper needs to be redefined to enrich the dataset - some issues

got a bs4 scraper that works with selenium - see far below: well - it works fine so far: see far below my approach to fetch some data form the given page: clutch.co/il/it-services To enrich the scrap…

Uploading a file in a embed discord.py (not a image)

Im trying to upload a file directly in a embed, I can upload the file but I dont find the way to put it in the embed. What I want is not displaying the file but uploading it so we can download it, is i…

Cannot install psycopg2 on virtualenv

Hi I use manjaro Linux and I tryed to install psycopg2 packge inside virtualenv but it gave errror error: command gcc failed with exit status 1. Then in the console I tryed gcc --version it saidbash: …

how to execute different print function based on the users input

I am a complete beginner to coding and python so It is probably very simple. So my problem is that am learning how to put if and else function based on the users input and i dont know how to connect be…

matplotlib - AttributeError: module numbers has no attribute Integral

I am a newbie to python and i am trying to learn online. I tried importing matplotlib on python 3.6 but i keep getting this error:problem in matplotlib - AttributeError: module numbers has no attribute…

How to extract social information from a given website?

I have a Website URL Like www.example.comI want to collect social information from this website like : facebook url (facebook.com/example ), twitter url ( twitter.com/example ) etc., if available anywh…

Check if string is of nine digits then exit function in python

I have a function in python that returns different output of strings (Text). And I have different parts that I should check for the string and if the string is of nine digits or contains 9 digits then …

How to extract quotations from text using NLTK [duplicate]

This question already has answers here:RegEx: Grabbing values between quotation marks(20 answers)Closed 8 years ago.I have a project wherein I need to extract quotations from a huge set of articles . H…