zendframework/zend-validator

How to reject e-mail addresses with UTF-8 characters in the local part?

Opened this issue · 3 comments

zend-validator 2.9.0 used to reject e-mail addresses with utf-8 characters in the local part (e.g. å or ö). As of zend-validator 2.10.0, such e-mail addresses seem to be considered valid. We are using postmark to send e-mails, which throws an exception at such e-mail addresses. Is there a way to configure Zend\Validator\EmailAddress to reject these e-mail addresses?

As a workaround, I have extended the EmailAddress validator like this:

class EmailAddress extends \Zend\Validator\EmailAddress
{
    protected function validateInternationalizedLocalPart($localPart)
    {
        return false;
    }
}

This seems to work. Is there any better way to handle this?

Have same problem: Amazon SES allow only 7-bit ASCII characters in local part of e-mail Amazon SES API Docs.

I'm not sure if your workaround is best solution, i would prefer flag to be able switch between those utf-8 characters.

This repository has been closed and moved to laminas/laminas-validator; a new issue has been opened at laminas/laminas-validator#7.