This project is read-only.

Create a message after being Sent

Topics: Help requests
Feb 12, 2014 at 5:42 PM
I am using System.Net.Mail to send mail using an imap server.
The mail server does not create a copy of the mail to a "Sent folder".

How I can create a message in a certain folder? (In this case in the Sent folder)

Feb 12, 2014 at 6:47 PM
Edited Feb 12, 2014 at 6:47 PM
Hi gvaldesmcl,

to save a System.Net.MailMessage to the sent folder you can use the following code:
// Create and send a message using System.Net.Mail
var mailMessage = new System.Net.Mail.MailMessage();
// ... send logic here ..

// Creating an ImapClient
var client = new ImapClient("", true);

// Connecting

         // Authenticating
         if(client.Login("", "password"))

                  // Saving the System.Net.Mail.MailMessage directly to Sent folder:


Hope this helps,

Best regards,

Feb 13, 2014 at 1:05 AM
Edited Feb 13, 2014 at 1:07 AM
Thanks for the Reply!

The code seems to compile and run with no problems, but for some reason its not working.

The statement "client.Folders.Sent.AppendMessage(mailMessage);" returns FALSE (does it mean is not appending the email?)

My imap folder structure (I'm not using gmail, no ssl and authentication required) are like: INBOX.Drafts, INBOX.Sent, INBOX,Trash, etc.
So I tried in many ways:


But all return False.

Another thing that I observe while debugging is that the client.UserLogin and client.UserPassword throws a "System.NotSupportedException"

Any ideas??

Feb 14, 2014 at 10:54 AM
Edited Feb 14, 2014 at 10:54 AM
Hi gvaldesmcl,

you don't need to lookup the folder by its name unless it not has been recognized automatically. Simply access it through client.Folders.Sent if it's not null. I will give it a try today, actually appending the message should work without any problems.

As for your question about client.UserLogin and client.UserPassword, these two properties are obsolete and relaced by client.Credentials.