How to get the "date" of an email?

I am creating an application that receives mail from a mail server. I use "System.Net.Mail.MailMessage" to receive email. Now I want to get the "Date and Time" of each email that is in the inbox.

+8
source share
2 answers

You need to look at the headers of the letters, here is the documentation

http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.headers.aspx

message.Headers["Date"]; 
+16
source

I checked the MailMessageObject and found the following:

  Headers=HeaderCollection(5) { "Uid", "DateCreated", "DateReceived", "Date", "IsRead" 

This means that you have three options. The output will be in string format.

 message.Headers["DateCreated"]; message.Headers["DateReceived"]; message.Headers["Date"]; 
0
source

All Articles