Wednesday, March 28, 2007

MailMessage Subject Property Error

Just a small problem this time for the .Net 2.0 Migration. Assigning a string that contains line feed characters to the Subject property on a System.Net.MailMessage object will result in an error being thrown that says:

The specified string is not in the form required for a subject.

Just make sure you strip out any carriage returns (\r) or line feeds (\n) from your string before you assign it and everything will be fine.

So done, onto the next one...

No comments: