We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting only sent time from email header

Hi Aspose,

I'm trying to get the email received time from email message. using msg.Headers.Get("Received").

But it returns the lot of information as below. is there any other way to get only the email received date?
[by 10.68.191.201 with SMTP id ha9csp261398pbc; Tue, 17 Dec 2013 19:21:49 -0800 (PST),from mo.mxl.2iij.net (mo1502.mxl.2iij.net. [203.180.99.20]) by mx.google.com with ESMTPS id q8si13175077pav.202.2013.12.17.19.21.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Dec 2013 19:21:49 -0800 (PST),by mo.mxl.2iij.net (mxl-mo1502) id rBI3LlSg023057; Wed, 18 Dec 2013 12:21:48 +0900,from unknown [210.173.21.247] (EHLO mx03.abc.co.jp) by mas1500a.mxl.2iij.net(mxl_mta-6.15.0-9) over TLS secured channel with ESMTP id bc411b25.0.148876.00-452.259672.mas1500a.mxl.2iij.net (envelope-from ); Wed, 18 Dec 2013 12:21:48 +0900 (JST),from mailgw1.abc.com ([13.198.8.182]) by mx03.abc.co.jp with ESMTP id rBI3Llfm007397 for ; Wed, 18 Dec 2013 12:21:47 +0900,from unknown (HELO SGPAPHQ-EXHUB03.dc01.abc.net) ([13.198.9.250]) by mailgw1.abc.com with ESMTP; 18 Dec 2013 11:21:47 +0800,from sgpaphq-exccr01.dc01.abc.net ([fe80::350d:30d6:d652:dac5]) by SGPAPHQ-EXHUB03.dc01.abc.net ([2002:dc6:9fa::dc6:9fa]) with mapi; Wed, 18 Dec 2013 11:21:46 +0800]

Hi Nayana,


Thank you for writing to us.

Please use the “Date” header of the email to get the email date as follow. Please let us know if we can be of any additional help to you in this regard.

msg.Headers.Get(“Date”);

Thank you Kashif,

You save my time.

Hello,


I am running into the same issue and I don’t think the resolution is quite correct i.e. getDate will return the SentDate and not the ReceivedDate - see a similar explanation here: EMail Questions. So, they do say to use msg.getHeaders().get(“Received”); for the ReceivedDate. However, I am getting this huge string as well. This looks like a bug. We also can’t use the mapi as in this particular case it is an EML message.

Thank you,
Kesha Veniaminov

Hi Kesha,

The “Received” header basically refers to the header information field “Received” as shown in this screenshot. This information contains all the intermediate servers information through which the message is routed and reaches the destination. Hence, the string can be lengthy as well due to multiple servers involved.

With respect to the received date information, this is almost the same as that of sent date with just a couple of seconds change normally. For received messages, this can be retrieved using the “Date” field as mentioned earlier. Please let us know if we can be of any additional help to you in this regard.