Get date and time of a mail message in gmail

Hello all,

I am trying to a log of the emails i received and put it to an excel file.

I am able to get the sender(assign mail.From.Address to string) and the text in the mail but how can I get the time and date of the mail message from outlook?

Hi @dvn

You can access headers of the email object like this : myMailVar.Headers("property") .

To have an exhausted list of the properties you can get from the headers, you can get them from this link (MailMessage.Headers Propriété (System.Net.Mail) | Microsoft Learn).

Hope that helps.

Thanks

2 Likes

Hi @Srini84

Try below code

mailMessage.Headers("Date")

6 Likes

doing same but i am able to get for some mail and not getting for some mail