Free Support Forum - aspose.com

Insert Custom Properties into Email Before Send?

Dear Support,

I have found the following post: <A href="https://forum.aspose.com/t/41890</A> and was wondering whether it is possible to insert custom property into an email before send ?</P> <P>What we want to do is insert information about our files/cases/matter related into the email so that we can track the email when it is reply.</P> <P>We are currently insert the tag into the subject of the email but the subject line was too long.</P> <P>Regards Dat.</P>

Hi Dat,

Thank you for inquiry.

The custom properties are preserved when we write a property to file and read it again. But, when the message is sent using Smtp or Exchange and read back using Imap or Exchange, the custom properties are lost.

We will check in more detail to see if it is possible to retain the custom properties sent/received using email.

Hi Dat,

I am sorry custom properties cannot be read once email is loaded using MailMessage and sent via Smtp or Exchange Servers. These custom properties are valid for Outlook MSG files only and MapiMessage class can handle it. They will be lost, when the message is loaded in MailMessage.

You may send such information (file, case number etc) in email headers.

MailMessage msg = new MailMessage(sender, receiver, subject, “check the custom header”);
msg.Headers[headerKey] = headerValue;

I also attached the sample VS2008 project for your convenience.

Dear Saqib,

You have save me a lot of times with your sample code, Thank you.

I have tested, from our exchange server - and out to "messagelabs" the Transport Header was replaced with messagelabs Header.

We use external service (messagelabs) to filter In/Out Messages.

Is there other internal field that we can safely use? because we don't know what our clients email server would do this fields either.

Many Thank
Regards Dat.

Hi Dat,



Some mail servers remove the headers and add their own to avoid spam or hidden code/text in emails. I am sorry we do not have expertise in this regard, could you please consult with someone from messagelabs, what they say about adding such headers in email?

Dear Saqib,

Thank you, again. I'll contact messagelabs to see what they say.

Regards Dat.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan