0 votes

I have tried to use the Upload(string folder, IMail email) method of Mail.dll Imap client, but i receive always this error from server:

Limilabs.Client.IMAP.ImapResponseException : [TRYCREATE] Folder doesn't exist. (Failure)

My test code is this:

using (Imap imapClient = new Imap())
{
    imapClient.ConnectSSL("imap.gmail.com");
    imapClient.UseBestLogin("user@gmail.com", "password");

    imapClient.UploadMessage(@"[Gmail]\Sent Mail", eml);

    imapClient.Close();

}

What am i doing wrong?

by

1 Answer

0 votes
 
Best answer

You probably used incorrect folder name (@"[Gmail]\Sent Mail" instead of @"[Gmail]/Sent Mail").

It's also better to use CommonFolders class that recognize IMAP folders (using XLIST, SPECIAL_USE or names):

List<FolderInfo> folders = imapClient.GetFolders();
CommonFolders common = new CommonFolders(folders);
imapClient.UploadMessage(common.Sent, mail);
by (297k points)
...