I have successfully used MAILKIT/MIMEKIT api for sending/receiving emails. Now, i am using the IMAP function to download the INBOX and SENT items emails and store them locally? What should I use a database ? or how should I proceed ?
Asked
Active
Viewed 1,769 times
0
-
This will be an [useful thread](https://www.codeproject.com/Tips/878383/Download-Mail-Details-With-attachment-using-IMAP) – sujith karivelil Nov 06 '17 at 06:35
-
isnt it about the ActiveMail DLL? However, I am using the MAILKIT/MIMEKIT dll at the moment. – Fuzed Mass Nov 06 '17 at 07:57
1 Answers
1
You can use a database or you can save all of the messages into a Maildir structure, or you could even save all of the messages to a single file like an mbox.
How you decide to handle this is completely up to you.

jstedfast
- 35,744
- 5
- 97
- 110
-
Thanks again, you always respond to my mailkit related queries, which is great. I am thankful of you. Can you guide me a book or documentation to have good understanding of Email and developing email client. Like this maildir or mbox ... I mean I hadn't heard about these terms previously. But now I will read it. Just a general book to give me good idea of developing email client using Mailkit/Mimekit ? – Fuzed Mass Nov 07 '17 at 16:21
-
I know this question is old but i have been looking for an example of how to save all messages to a single file like a .mbox file and have been unsuccessful. Do you have an example you could list here for me and anyone in the future looking for this? – AdamH409 Sep 20 '21 at 19:45
-
`var fromLine = Encoding.ASCII.GetBytes ("From -" + Environment.NewLine); foreach (var uid in uids) { var message = client.Inbox.GetMessage (uid); mboxStream.Write (fromLine, 0, fromLine.Length); message.WriteTo (mboxStream); }` – jstedfast Sep 20 '21 at 19:55
-
Thx jstedfast!!! I was hoping for a more complete example as i'm not familiar with an mboxStream nor the reason for the fromLine. I assume the mboxStream is just a FileStream? Would something like this work? `var exportStream = new MemoryStream(); foreach (var uid in uids) { var message = client.Inbox.GetMessage(uid); message.WriteTo(exportStream);} exportStream.Position = 0; using (var fileStream = File.Create(@"C:\temp\results.mbox")) { exportStream.Seek(0, SeekOrigin.Begin); exportStream.CopyTo(fileStream); }` – AdamH409 Sep 20 '21 at 20:22
-
Ask a new StackOverflow question and I will post some code. Yes, an mbox stream is just a file stream, but your code won't work. – jstedfast Sep 20 '21 at 20:34
-
I have posted a new question here https://stackoverflow.com/questions/69260543/how-to-save-all-messages-to-a-single-mbox-file-using-mailkit-mimekit-imap – AdamH409 Sep 20 '21 at 20:38