Solved a really serious mystery today
25 Sep 2008Our customer has a e-mail campaing system that sends out around 30.000 opt-in emails to its customers every now and then. Nothing spectacular but it handles keyword substitution, independent operation for long running tasks, some pretty wild cyrillic texts.
Recently though sending newsletters to customers with non ASCII characters in their names stopped working, something which did work before, the only recent changes were some added tracing instructions and exception handling.
Here’s why!
Calling the ToString()
method before ToEncodedString()
(which is called when sending the message) will pollute the MailAddress
internal state with an unencoded version of the address that is returned as a cached version on subsequent calls to ToEncodedString()
.
Turns out some of the added tracing code printed out the address of the receiver it was processing at the moment, triggering the bug in the framework.
Now, if I could only find somewhere to report this…