select folder failed
我登录了126邮箱,发现select folder报错: Select or examine mailbox failure. 代码如下:
int main()
{
try
{
imaps conn("imap.126.com", 993);
// modify username/password to use real credentials
std::cout << 1 << std::endl;
conn.authenticate("[email protected]", "xxxx", imaps::auth_method_t::LOGIN);
std::cout << 2 << std::endl;
imaps::mailbox_folder fld = conn.list_folders(list
return EXIT_SUCCESS;
}
我在网上搜了一下,发现python模块imapclient在登陆126邮箱之前需要调用client.id_(parameters={"name": "dwn_mail", "version": "1.0"}), 不知道mailio怎么做到
Hello, what is the name of the folder? Is it in the Latin alphabet?
the folder name is ZT_AFZ, it in Latin alphabet,
Let me try it with my own test.
There is nothing wrong with such name. What is the full directory path? I see you are selecting the TEST directory. This message can be thrown in case the directory path is wrong.
The 126 provider has only the Chinese version or it can be switched to English?
I changed the folder name from 'ZT_AFZ' to 'TEST' when paste.This issue is caused by 126 server, when I using imapclient (a python module) do the same thing, and got a similar error, after search google, the stack overflow told me that I need client.id_(parameters={"name": "dwn_mail", "version": "1.0"}) before client.login. so I want do the same thing in mailio
So, you get the same error with Python?
if no client.id_(parameters={"name": "dwn_mail", "version": "1.0"}), python error: imaplib.error: select failed: SELECT Unsafe Login. Please contact [email protected] for help
Can you please copy here the minimal reproducible example in Python, so I could try it?
import os import sys import email import mimetypes from imapclient import IMAPClient import datetime
if 3 != len(sys.argv): print(f'usage:{os.path.basename(sys.argv[0])} save_pth from_date') sys.exit(0)
save_dir, since_date=sys.argv[1:] user='[email protected]' password='xx' host='imap.126.com'
since_date = int(since_date) since_year = since_date//10000 since_mon = since_date%10000//100 since_day = since_date%100 since_date = datetime.date(since_year, since_mon, since_day) server = IMAPClient(host, use_uid=True) #server.id_(parameters={"name": "dwn_mail", "version": "1.0"}) server.login(user, password) selected_info = server.select_folder('ZT_AFZ') messages = server.search([b'SINCE', since_date])