Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed "Invalid header value detected" when sending an email to a pers… #10

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

erfanimani
Copy link
Collaborator

…on with a name containing non-ASCII characters

  • Laminas addHeaders expects ASCII characters only
  • Using LaminasMessage::addTo circumvents this check

Fixes #9

…on with a name containing non-ASCII characters

* Laminas addHeaders expects ASCII characters only
* Using LaminasMessage::addTo circumvents this check
@scottsb
Copy link

scottsb commented Jan 5, 2022

I'm not sure this is the correct solution here. The documentation indicates that ASCII is simply the default, but it clearly illustrates adding a To address with a different encoding:
https://docs.laminas.dev/laminas-mail/message/character-sets/

I think instead of this roundabout approach, it may be sufficient to simply add:

$message->setEncoding('UTF-8');

If that approach is taken, a couple other notes (old articles, so not sure if still relevant):

I'm not currently set up to be able to test this to confirm, though.

@erfanimani
Copy link
Collaborator Author

I see. I think I might have tried that, although it was a while back. All that it's doing, is using the Lamina's Message addTo method, that (I believe) appropriately detects and sets encoding, and sorts out what needs to be done to get it delivered, without having to worry about encoding.

But maybe forcing the encoding will convert the headers as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

"Invalid header value detected" when sending an email to a person with a name containing non-ASCII characters
3 participants