By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,510 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

Adding custom Mail header to System.Net.Mail.MailMessage

P: n/a
I am creating MailMessage out of already existing email message.
My existing message has few custom properties. I wan to add them to
System.Net.Mail.MailMessage

How to add custom properties?

I was thinking adding custom properties to
System.Net.Mail.MailMessage.Headers. but it's a READONLY property.
System.Net.Mail.MailMessage has few header fields as properties (eg:
FROM, TO, CC) and these are not sufficient.

So, if I have to use System.Net.Mail.MailMessage, do I have to ignore
the custom header properties?

Thanks
Ramesh

Jan 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello,

Readonly in this case means you cannot set up a reference yourself.
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.Headers.Add("MyCustomeHeader", "value");

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"as*******@gmail.com" wrote:
I am creating MailMessage out of already existing email message.
My existing message has few custom properties. I wan to add them to
System.Net.Mail.MailMessage

How to add custom properties?

I was thinking adding custom properties to
System.Net.Mail.MailMessage.Headers. but it's a READONLY property.
System.Net.Mail.MailMessage has few header fields as properties (eg:
FROM, TO, CC) and these are not sufficient.

So, if I have to use System.Net.Mail.MailMessage, do I have to ignore
the custom header properties?

Thanks
Ramesh

Jan 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.