Synchronization between DB and mail server

May 19, 2013 at 9:15 AM
I work on some project, web email client in asp.net, something like thunderbird (for now only imap) . I have database on server where I store mails and all related data. What is best way to synchronize my database and email account.
Thanks for help.
Coordinator
May 21, 2013 at 9:20 AM
Hi.
I had a experience to create web mail client application with ASP.NET by my work.
I'll show you how I created it.

I created Uid column to table.
We can get Uid by List pop3 command and save it.

var cl = new Pop3Client();
var ul = cl.ExecuteUidl();

Before insert mail data to database, check that the uid already exist or not.
If the uid exist, don't insert record.
Background console application execute above process with 5 minute interval.

And finally, ASP.NET web page show mail list from database.

Is it helpful?
May 21, 2013 at 6:05 PM
For now I use IMAP only. In IMAP client there is only ExecuteUid(string command) method which I don't know how to use. I know that every message have Uid, id atribute of MailMessage class doesn't contain uid but something else. By the way is there a way to get only header of message without to download whole message like with GetMessage(int index), that is to slow.
Coordinator
May 23, 2013 at 2:35 AM
Edited May 23, 2013 at 2:49 AM
Hi.

You can get uid list by below code.

var cl = new ImapClient();
//...set property and select folder....
var rs = cl.ExecuteUid(" Search All");
var result = new SearchResult(cl.Tag, rs.Text);
var l = result.MailIndexList; // this include uid list

I think this is not intuitive way.
Now, there is no easy way to get uid list in ImapClient object.
So, I'll add some intuitive method that help developer to get uid list from server.
I plan to add GetUidList method and this method return List<Int64> that include uid list.

I'll create it in a few weeks.

regards.
May 23, 2013 at 7:36 AM
It would be also usefull if You make some methods to get message by uid and to get header of message without attachmets.
Thanks for help.
May 25, 2013 at 2:29 PM
I really need to get only header of message. Is there a way to accomplish this with current version of library?
Coordinator
May 27, 2013 at 12:42 AM
Current version does not provide this feature.
I'll add it in future realease.