Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Cannot fetch IMAP messages #518

Open
edwardzcn-decade opened this issue Dec 10, 2024 · 6 comments
Open

[Bug] Cannot fetch IMAP messages #518

edwardzcn-decade opened this issue Dec 10, 2024 · 6 comments
Assignees

Comments

@edwardzcn-decade
Copy link

Hi, I use IMAP to test one email account. After setting the configuration and solving the tls problem. Finally, envelope list only work for 1 mail which send/receieve by my self.

you can see from the output: 1

2024-12-10T09:44:07.320899Z DEBUG email::email::envelope::list::imap: found 1 imap envelopes

| ID               | FLAGS             | SUBJECT            | FROM                      | DATE                              |
|------------------|-------------------|--------------------|---------------------------|-----------------------------------|
| 1242             |                   | Hihi               | Chuannan Zhang            | 2024-12-10 17:26+08:00            |

Bug

Next I send a test email (with only 'test' body) from gmail/output. And himalaya return error. Seems it successfully links to the INBOX and finds exists(2) with the incoming mail. But it cant resolve the IMAP task.

2024-12-10T09:39:22.663292Z DEBUG keyring::service: define global service name name="himalaya-cli"
2024-12-10T09:39:22.670467Z  INFO himalaya::email::envelope::command::list: executing list envelopes command
2024-12-10T09:39:22.672094Z DEBUG email::imap: building 1 IMAP clients
2024-12-10T09:39:22.680882Z DEBUG client::build: rustls::client::hs: No cached session for DnsName("imap.qq.com")    
2024-12-10T09:39:22.681651Z DEBUG client::build: rustls::client::hs: Not resuming any session    
2024-12-10T09:39:22.736403Z DEBUG client::build: rustls::client::hs: ALPN protocol is None    
2024-12-10T09:39:22.736420Z DEBUG client::build: rustls::client::hs: Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256    
2024-12-10T09:39:22.736720Z DEBUG client::build: rustls::client::tls12: ECDHE curve is EcParameters { curve_type: NamedCurve, named_group: secp256r1 }    
2024-12-10T09:39:22.736729Z DEBUG client::build: rustls::client::tls12: Server DNS name is DnsName("imap.qq.com")    
2024-12-10T09:39:23.102235Z DEBUG client::build: email::imap: using password authentication
2024-12-10T09:39:23.102304Z  INFO client::build: process::command: run shell command cmd="pass show qqmail"
2024-12-10T09:39:23.102314Z DEBUG client::build: process::command: inherit stdin from parent
2024-12-10T09:39:23.102320Z DEBUG client::build: process::command: stdout piped
2024-12-10T09:39:23.102324Z DEBUG client::build: process::command: stderr piped
2024-12-10T09:39:23.342150Z DEBUG client::build: process::command: shell command gracefully exited code=0
2024-12-10T09:39:23.342386Z DEBUG client::build: email::imap: supported auth mechanisms mechanisms=[Plain, Login, XOAuth2]
2024-12-10T09:39:23.342401Z DEBUG client::build: email::imap: trying auth mechanism… mechanism=Plain
2024-12-10T09:39:23.589632Z DEBUG client::build: email::imap: authentication succeeded! mechanism=Plain
2024-12-10T09:39:23.591261Z  INFO email::email::envelope::list::imap: listing IMAP envelopes from mailbox INBOX
2024-12-10T09:39:23.591714Z DEBUG email::imap: client 1/1 is free, locking it
2024-12-10T09:39:23.592300Z DEBUG email::email::envelope::list::imap: UTF7-encoded mailbox name="INBOX"
2024-12-10T09:39:23.713906Z  WARN select_mailbox{client=1}: imap_codec::response: Rectified missing `text` to "..."    
2024-12-10T09:39:23.713993Z DEBUG email::email::envelope::list::imap: mailbox selected name="INBOX" data=SelectDataUnvalidated { flags: Some([Answered, Flagged, Deleted, Draft, Seen]), exists: Some(2), recent: Some(0), unseen: Some(1), permanent_flags: Some([Asterisk, Flag(Answered), Flag(Flagged), Flag(Deleted), Flag(Draft), Flag(Seen)]), uid_next: Some(1247), uid_validity: Some(1517461405) }
Error: 
   0: cannot fetch IMAP messages
   1: cannot resolve IMAP task
   2: unexpected BAD response: Sequence set is inavlid!

Location:
   /Users/edwardzcn-mini/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pimalaya-tui-0.2.1/src/himalaya/backend.rs:513
@soywod
Copy link
Member

soywod commented Dec 10, 2024 via email

@edwardzcn-decade
Copy link
Author

edwardzcn-decade commented Dec 10, 2024

It does work with --page-size 0 param. Here is the result:

image

But why I need this param. I find the explanation in the sample config that customize the number of envelopes to show by page.

Would it be possible for you to create us a fake account there, so I could debug? You can send me credentials either as a private message on the Matrix chat, or by email at: clement.douin at posteo.net

Sry that I could not provide you a fake account to test. In short, the qq.com mail service asks for phone number registered with ID card :( However, is it possible to hypothesize the path (e.g., whether it lies in the client or the core dependency) based on the trace information in the first paragraph? I will continue conducting some tests in this area.

BTW, I use Gmail in my daily life through proxy tools. I mentioned in the core repository issue, this requires proxy feature support in advance. I just want to quick start wihout oauth2 setting up and proxy so I choose qq mail service

@soywod
Copy link
Member

soywod commented Dec 10, 2024

But why I need this param. I find the explanation in the sample config that customize the number of envelopes to show by page.

When using --page-size 0 you disable the pagination, therefore the IMAP sequence sent is not the same (1:*, versus 1,2,3,4…). I don't get why the server sends an error on the sequence set received. Unfortunately the sequence is not logged. I will add a log soon, then you can either wait for the next patch release or build from sources (using Cargo directly).

@DreamMaoMao
Copy link

I also have this problem, but I can use imap.qq.com mailbox in aerc.

@DreamMaoMao
Copy link

2024-12-29T00:00:29.554522Z DEBUG list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}: email::email::envelope::list::imap: UTF7-encoded mailbox name="INBOX"
2024-12-29T00:00:29.554631Z TRACE list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}:select_mailbox{client=1}: imap_client::stream: wrote 27/27 bytes
2024-12-29T00:00:29.625562Z TRACE list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}:select_mailbox{client=1}: imap_client::stream: read 298/1024 bytes
2024-12-29T00:00:29.625686Z  WARN list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}:select_mailbox{client=1}: imap_client::tasks::tasks::select: missing required UNSEEN OK untagged response
2024-12-29T00:00:29.625719Z DEBUG list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}: email::email::envelope::list::imap: mailbox selected name="INBOX" data=SelectDataUnvalidated { flags: Some([Answered, Flagged, Deleted, Draft, Seen]), exists: Some(7), recent: Some(0), unseen: None, permanent_flags: Some([Asterisk, Flag(Answered), Flag(Flagged), Flag(Deleted), Flag(Draft), Flag(Seen)]), uid_next: Some(3693), uid_validity: Some(1415888772) }
2024-12-29T00:00:29.625882Z TRACE list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}:fetch_envelopes_by_sequence{client=1}: imap_client::stream: wrote 59/59 bytes
2024-12-29T00:00:29.685929Z TRACE list_envelopes{folder="INBOX" opts=ListEnvelopesOptions { page_size: 10, page: 0, query: None }}:fetch_envelopes_by_sequence{client=1}: imap_client::stream: read 43/1024 bytes
Error: 
   0: cannot fetch IMAP messages
   1: cannot resolve IMAP task
   2: unexpected BAD response: Sequence set is inavlid!

@soywod
Copy link
Member

soywod commented Jan 1, 2025

I will add the log for the next patch release. From there we will be able to debug properly this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants