How to add Received header to the first position in MailMessage object

Scenario: I use SmtpClient to send message (previously received from Exchange Online) to the smart host. According to RFC I need to add Received header, so that it appears before all other headers.


I use Add method, because there are no Insert method:

ms.Headers.Add(“Received”, “value”);

Issue: My Received header appears after other Received headers. Is their API to add first header.

To see it in action:

var m0 = MailMessage.Load(“dsample.eml”,
new EmlLoadOptions { PreserveTnefAttachments = true });
m0.Headers.Add(“Received”, “Value”);
m0.Save(“sample-resaved.eml”);

Thanks,
Alex Shloma

Hi Alex,

Thank you for contacting Aspose Support team.

There is no “Insert” method at present to achieve this. We have logged this requirement as EMAILNET-35222 in our issue tracking system for further consideration by our Product team and will update you here once there is some information available in this regard.

The issues you have found earlier (filed as EMAILNET-35222) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.