I discovered if the FromName contains a comma the email was being rejected by our SMTP server. Doing more testing, I could see double quotes being stripped out and angle brackets also causing the email to be rejected.
Looking at RFC 5322 it seems like this display-name can be a quoted-string when it contains any of the specials.
In my case I escaped with a backslash any existing backslashes and double quotes, then wrapped the whole string in double quotes. It would be nice if the library handled this (though it would mean my code will cause extra characters to be sent 😅).
I discovered if the
FromNamecontains a comma the email was being rejected by our SMTP server. Doing more testing, I could see double quotes being stripped out and angle brackets also causing the email to be rejected.Looking at RFC 5322 it seems like this
display-namecan be aquoted-stringwhen it contains any of thespecials.In my case I escaped with a backslash any existing backslashes and double quotes, then wrapped the whole string in double quotes. It would be nice if the library handled this (though it would mean my code will cause extra characters to be sent 😅).