karastojko/mailio

Selecting nested folders and fetching messages in nested folders

JonathanBouligny opened this issue · 1 comments

Hi, I'm trying to select each message in a folder in order, read the messages, download the attachments and then delete the message.

I'm using a mail service that has a nested folder structure like Parent Folder/NestedFolder. They call them labels but they seem to act as folders.
With the code
mailio::imaps::mailbox_stat_t ret = conn.select(std::list<std::string>({"Parent Folder","NestedFolder"}));
I was able to select FolderB and view some stats about it, however two things are happening when i do this.
It shows the correct number of messages in the folder however it wont give me the UID of the first message with uid_next.
How do i get the uid of each message in the folder in order? I want the uid of all the messages and to handle all the messages in the folder.

I also cant seem to figure out how to use fetch. When i use the following code:
conn.fetch("NestedFolder", (uid), msg);
It gives me the error
Select or examine mailbox failure.
How do select a nested mailbox folder?

JK i figured it out.

mailio::imaps::mailbox_stat_t ret = conn.select(std::list<std::string>({"Parent Folder","Nested Folder"}));
mailio::message msg;
msg.line_policy(mailio::codec::line_len_policy_t::VERYLARGE, mailio::codec::line_len_policy_t::VERYLARGE);
conn.fetch(1, msg);

Needed to remove the "NestedFolder" part