views:

875

answers:

2

I get the following when tying to serialize a mial message using the los foratter.

Error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'System.Net.Mail.MailMessage' of type 'System.Net.Mail.MailMessage.'

Is there an EASY way to serialize this object or am I going have to searialize each o fhte properties individually?

+1  A: 

Sadly, the System.Net.Mail.MailMessage class is not marked as serializable. So, yes, you'll need to do it yourself. There's a technique described in the following blog post that can give you an idea of how you might proceed: How to Serialize a MailMessage ... basically, you will need to pull out each of the properties individually.

Chris W. Rea
+1  A: 

You can binary serialize a MailMessage using the code provided here. Enjoy. http://meandaspnet.blogspot.com/2009/10/how-to-binary-serialize-mailmessage-for.html

Nikolaj