sendgrid-php icon indicating copy to clipboard operation
sendgrid-php copied to clipboard

Email is not expanded in error message

Open gemal opened this issue 4 years ago • 2 comments

Got this error: ERROR: error: '"$emailAddress" must be a valid email address. Got: xxxxx@gmailæ.com' - #0 sendgrid/sendgrid/lib/mail/EmailAddress.php(69): SendGrid\Helper\Assert::email('xxxxx@gma...', 'emailAddress')

$emailAddress should be expanded

https://github.com/sendgrid/sendgrid-php/blob/8fad4ab8031bc341293793b7a5b5a94a39862f7e/test/unit/EmailAddressTest.php#L675

is also wrong: "$name" must be a string ?

I think that test is all wrong

gemal avatar Dec 03 '20 15:12 gemal

Hello @gemal,

Thanks for bringing that to our attention! This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

With best regards,

Elmer

thinkingserious avatar Jan 08 '21 01:01 thinkingserious

@thinkingserious filter_var used in SendGrid\Helper\Assert::email does not support unicode emails. According to PHP docs FILTER_FLAG_EMAIL_UNICODE is applied only to the local part of the email address. Would it be okay to change it to matching ^(?!\.)((?!.*\.{2})[a-zA-Z0-9\u00E0-\u00FC.!#$%&'*+-/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\u00E0-\u00FC\-\.\d]+)((\.([a-zA-Z]){2,63})+)$ regex (from https://www.regextester.com/108260)?

bancer avatar Jan 28 '21 16:01 bancer