0 votes
by (260 points)

I'm using Rebex to create a MailMessage object from the stream of an email obtained through Graph. The response of the call shows the receivedDateTime property properly populated, but when I use the following code:

MailMessage mailMessage = new MailMessage();
mailMessage.Load(stream);

The mailMessage.ReceivedDate property turns out to be null. Does anyone have any ideas on how to resolve this issue or has encountered a similar situation before? Thanks in advance for the help!

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (144k points)

The MailMessage.ReceivedDate property represents the first "Received" MIME header in the input message. If there are no "Received" headers in the message, or if the header could not be parsed, the property returns null.

Try saving the message into a file:

using (var output = File.Create("message.eml"))
{
    stream.CopyTo(output);
}

Then, open the file using a text editor such as Notepad and check whether there are any "Received" headers.

...