This project is read-only.

MailMessage.To/Cc/Bcc properties don't allow assignment


The way the To, Cc, & Bcc properties create MailAddressCollection collections by parsing the headers on the fly doesn't allow the header values to be created or changed. Basically, they always create and return a temporary MailAddressCollection (in MailAddressCollection.Parse) that if modified by calling the Add() member (in MimeMailMessageConverter.ConvertFrom), those changes never get stored back to the message object. This causes the values added to properties like "To" to get ultimately discarded. Furthermore when assigning new MailAddressCollection objects to properties like "To" it always adds the header values again, instead of replacing existing entries which creates duplicates. These duplicates then interfere with retrieving values for To/Cc/Bcc properties.
One possible work around with to stop the empty To/Cc/Bcc MailAddressCollection from getting added in the MailMessage constructor and then building and assigning a MailAddressCollection directly to the To/Cc/Bss field when parsing but I think a better solution needs to be worked out.
Btw, all the levels of properties and auto conversions between strings and collections makes this unnecessarily complicated to debug. I think some simplication is in order.