\Zend\Mail\Header\HeaderValue should support unicode characters
This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7656 User: @akosphp Created On: 2016-01-02T14:42:06Z Updated At: 2016-02-13T15:34:17Z Body The isValid method doesn't support unicode characters in the header value. This is a problem for example when unicode email address is given. (eg.: üñîçøðé@example.com - which is a valid email address)
Unicode email addresses cause Zend\Mail\Header\Exception\RuntimeException in vendor\zendframework\zend-mail\src\Header\HeaderValue.php:115 Exception message: Invalid header value detected.
Originally posted by @GeeH at https://github.com/zendframework/zend-mail/issues/96
Any known workarounds for this issue?
Originally posted by @chadabaker at https://github.com/zendframework/zend-mail/issues/96#issuecomment-519491891
Read https://docs.zendframework.com/zend-mail/message/intro/ and just use correct encoding.
Originally posted by @coder-pm at https://github.com/zendframework/zend-mail/issues/96#issuecomment-525195463
Any news on this ? Patch? Workaround ?
@smsalert-mobi send one 👍
Any news on this ? Patch? Workaround ?
@smsalert-mobi please set encoding: https://docs.laminas.dev/laminas-mail/message/character-sets/
Any news on this ? Patch? Workaround ?
@smsalert-mobi please set encoding: https://docs.laminas.dev/laminas-mail/message/character-sets/
you can't when using IMAP / POP3 this fails as soon you are trying to iterate over inbox
a workaround is not to Iterate over imap / pop3 (built in) and do a for loop, this way you can use try / catch per message and ignore the "invalid" ones.
$mail = new Imap([
'host' => '',
'user' => '',
'password' => '',
'ssl' => 'ssl',
]);
for ($index = 1; $index <= $mail->countMessages(); $index++) {
try {
$messageStorage = $mail->getMessage($index);
} catch (\Exception $e) {
//
}
}