Open renecatharsis opened 8 years ago
AFAIK umlauts are not allowed in an email address (yet). The current accepted standard is RFC 2822 and non ASCII characters are not allowed in the local-part there. Non ASCII characters are proposed in RFC 6531. But this is still markes as PROPOSED STANDARD and was not implemented in Zend\Validator\EmailAddress::validateLocalPart() (see: https://github.com/zendframework/zend-validator/blob/master/src/EmailAddress.php#L334). Which version of zend-validator do you use? isValid() returns false for me (2.5.3/latest stable).
I'm using v2.5.3 as well. Installed by composer as part of zendframework/zendframework": "2.* For me the validator returns true. intl extension is loaded, the function idnToAscii actually calls PHP's idn_to_ascii function.
Running on a Win7 x64 with PHP7.0.0 wampstack, if that helps.
Oh. You're right. Intl was not loaded in my test environment. I have looked up RFC 6531, 6530, 5336, 5891 and 5890 and could not find any reference that the local-part could be converted to IDN ASCII. Actually there are some hints that the local-part SHOULD NOT be converted.
RFC 5891:
IDNA does not update the existing email standards, which allow only ASCII characters in local parts. Even though work is in progress to define internationalization for email addresses [RFC4952], changes to the email address part of the SOA RDATA would require action in, or updates to, other standards, specifically those that specify the format of the SOA RR.
(https://tools.ietf.org/html/rfc5891#section-3.2.2)
RFC 6530:
In order to use internationalized email addresses, it is necessary to internationalize both the domain part and the local part of email addresses. The domain part of email addresses is already internationalized [RFC5890], while the local part is not.
(https://tools.ietf.org/html/rfc6530#section-1)
IMO the behavior in zend-validator is wrong.
However google gave me some results of people claiming that some email providers actually support IDN converted local-parts. Let's ask @svyatoslav-kubakh who implemented IDN (zendframework/zf2#7281). Maybe he can give us more information on this.
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/67.
Cloned this from zf2 issue repository for correct assignment to zend-mail:
https://github.com/zendframework/zf2/issues/7654
Hi,
since ZF v2.4.x, I cannot send any mails to recepients containing German umlauts in their mail address. For exmaple: testäöü@gmail.com Encoding is set to UTF-8 on Zend\Mail\Message object. The following expection is thrown:
Invalid header value detected #0 foobar\vendor\zendframework\zend-mail\src\Header\AbstractAddressList.php(114): Zend\Mail\Header\HeaderValue::assertValid('test\xC3\xA4\xC3\xB6\xC3\xBC@gmai...') #1 foobar\vendor\zendframework\zend-mail\src\Header\AbstractAddressList.php(158): Zend\Mail\Header\AbstractAddressList->getFieldValue(true) #2 foobar\vendor\zendframework\zend-mail\src\Headers.php(422): Zend\Mail\Header\AbstractAddressList->toString() #3 foobar\vendor\zendframework\zend-mail\src\Transport\Smtp.php(332): Zend\Mail\Headers->toString() #4 foobar\vendor\zendframework\zend-mail\src\Transport\Smtp.php(238): Zend\Mail\Transport\Smtp->prepareHeaders(Object(Zend\Mail\Message)) #5 foobar\vendor\Solar\library\Solar\Mail\Mail.php(144): Zend\Mail\Transport\Smtp->send(Object(Zend\Mail\Message)) #6 foobar\vendor\Solar\library\Solar\Client\AbstractClient.php(249): Solar\Mail\Mail->sendSmtp('processrevenuec...', Array, true, '') #7 foobar\modules\eonde\Processrevenuecheck.php(73): Solar\Client\AbstractClient->sendMail('test\xC3\xA4\xC3\xB6\xC3\xBC@gmai...', '', Array) #8 foobar\vendor\Solar\library\Solar\Bootstrap\Bootstrap.php(248): modules\eonde\Processrevenuecheck->run() #9 foobar\index.php(80): Solar\Bootstrap\Bootstrap->getResponse() #10 {main}
Umlauts work fine with the subject and body. Also, the value passes the \Zend\Validate\EmailAddress validator. It might be related to this issue although I cannot gain any workaround from it: https://github.com/zendframework/zf2/issues/7501
Update: Seems like RFC6531 was implemented in zend-validate but not yet zend-mail.