postmark-dotnet icon indicating copy to clipboard operation
postmark-dotnet copied to clipboard

Entering a "From" property can cause "illegal email address" exceptions

Open KoanLeeroy opened this issue 6 years ago • 2 comments

If you enter a message From property formatted like this:

message.From = $"{model.FromName} <{model.FromEmail}>"; AND model.FromName is a string with a value with a comma in it, the Postmark API fails.

The fix in this instance is to double quote the from name portion. Technically this should only be done when required according to the spec (RFC5322 https://tools.ietf.org/html/rfc5322#section-3.6.2)

Really this is the job of the SDK in my opinion. This would lead to less runtime issues.

A kinder SDK interface would look something like this... message.From = new Postmark(model.FromName, model.FromEmail);

KoanLeeroy avatar Jul 16 '18 08:07 KoanLeeroy

Did anything ever get updated for this? We recently ran into this issue as well, but it was on version 4.5.2.

soatley avatar Aug 06 '24 14:08 soatley

@soatley As far as I know nothing changed, if you have any issues please contact our support with more details. Regarding the comma in display-name - according to the rfc5322 comma is not allowed in not quoted-string

MariuszTrybus avatar Aug 09 '24 07:08 MariuszTrybus