Is there a way to serialize a .Net MailMessage object

Posted by Matt Dawdy on Stack Overflow See other posts from Stack Overflow or by Matt Dawdy
Published on 2010-04-21T15:55:44Z Indexed on 2010/04/21 16:03 UTC
Read the original article Hit count: 1184

Filed under:
|
|

I am trying to write a proc that will take in as a parameter a MailMessage object, and the split it apart to store the subject, body, to addresses, from address, and attachments (the hard part) in a database so the email can be sent at some point in the future.

My first take on this was to rip out the parts I need and store them in a database, and that works great except for attachments. I can't figure out how to loop through the collection and then actually do anything with them.

It there an easy way to serialize a MailMessage object that will actually take the content of the attachments with it?

Am I doing this all wrong? Has anyone done this before?

© Stack Overflow or respective owner

Related posts about email

Related posts about mailmessage