get sent mails via imap

2019-07-16 16:59发布

问题:

Does someone know how I can get all sent mails to specific user using AE.NET mail library?

I've tried something like this:

imap = new ImapClient(imapMailServer, username, password, ImapClient.AuthMethods.Login, imapMailPort, imapUseSSL);

if (imap.IsConnected)
{
    imap.SelectMailbox("INBOX");

    var msg = imap.SearchMessages(SearchCondition.To("examplemail@gmail.com"));
}

But without any success (msg collection is empty)...

EDIT (SOLUTION):

I had to select sent folder instead of inbox. Because I am using gmail, Gmail's sent mail folder is named "[Gmail]/Sent Mail". So it has to be:

imap.SelectMailbox("[Gmail]/Sent Mail");

回答1:

Are you looking for message you've sent? In that case, they're likely in the Sent folder, which is [Gmail]/Sent Mail on Google.



标签: c# email imap