Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the "Date" of an email?

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.

like image 706
Tavousi Avatar asked Oct 03 '12 12:10

Tavousi


People also ask

How can I find out when an email was sent?

Open the message you want to see the date for. Below the sender's name and next to the recipient's (usually, to: me) tap the down arrow to show more details. These details include the sender's email address, your email address, and the full date the message was sent.

How do I get the date to show on Outlook email?

Click on the View tab. Then click View Settings. From the Format drop-down menu (click the down arrow to the right of the format field), then select how you want it displayed.

Can you search a date on email?

To find emails from after a specific date, use After:YYYY/MM/DD. So for example, if you're trying to find emails from before or after September 1st, 2021, type either Before:2021/09/01 or After:2021/09/01 into the search bar and hit Enter. You can combine both keywords to find emails between two dates.

How do you timestamp an email?

The easiest way to insert the timestamp or the current date and time is hot keys. To insert current date in your email messages, please press the Alt + Shift + D keys at the same time. To insert current time in your email messages, please press the Alt + Shift + T keys at the same time.


2 Answers

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"];
like image 77
Micah Armantrout Avatar answered Sep 29 '22 01:09

Micah Armantrout


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"];
like image 26
Mark Avatar answered Sep 29 '22 02:09

Mark