Reputation: 15446
I create an application that gets email from mail server. I use "System.Net.Mail.MailMessage" for receive email. Now I want to get "Date and Time" of each email that ins in Inbox.
Upvotes: 11
Views: 18489
Reputation: 188
I inspected the MailMessageObject and found this:
Headers=HeaderCollection(5)
{
"Uid",
"DateCreated",
"DateReceived",
"Date",
"IsRead"
So that means you have a total of three options available to you. The output will be in string format.
message.Headers["DateCreated"];
message.Headers["DateReceived"];
message.Headers["Date"];
Upvotes: 1
Reputation: 6971
You will want to look at the emails headers here is some documentation
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.headers.aspx
message.Headers["Date"];
Upvotes: 20