3

I'm using the Mailkit framework to send (SMTP) and retrieve (IMAP) emails from an exchange server and that works fine.

Yet, I have the problem that emails that are sent with SMTP don't show up in the sent folder on the server (and therefore not in other mail clients and that's the main problem).

Is there a way to get these SMTP sent emails to the sent folder on the exchange server?

MeanGreen
  • 3,098
  • 5
  • 37
  • 63
Sinsay
  • 33
  • 1
  • 5

1 Answers1

3

What mail clients such as Outlook, Thunderbird, etc all do is that once the message has been sent via SMTP, they append the message to the "sent" folder on the IMAP server.

Once you get the appropriate Sent folder from the IMAP server, you just need to call the Append() method like this:

sent.Append (message);

Note: There is no need to open the sent folder first.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • Thanks, that really helped me out. Oh, and great framework by the way, hope you keep it going! – Sinsay Nov 02 '15 at 16:02
  • @jstedfast i get below errors.. The best overloaded method match for 'MailKit.IMailFolder.Append(MimeKit.MimeMessage, MailKit.MessageFlags, System.Threading.CancellationToken, MailKit.ITransferProgress)' has some invalid arguments....Error 2 Argument 1: cannot convert from 'System.Net.Mail.MailMessage' to 'MimeKit.MimeMessage'... how do i convert it – coder771 Jun 14 '16 at 11:15
  • Uh, yea, you have to cast the MailMessage into a MimeMessage. – jstedfast Jun 14 '16 at 13:54