-
Notifications
You must be signed in to change notification settings - Fork 111
Problem with special characters in headers #203
Comments
@jomofcw Can you provide an example header? What 'special characters' are you using? |
@webimpress here is the headers that seems to be the problem (after many test case to isolate it) :
The character "è" is the special one which make it crash. Replacing it by "é" still crash (and probably with each others special chars). |
@webimpress, previously, when I used zend-mail from ZendFramework v1 I add no problem with those special characters... and anyway, it's commonly used in name in france for example. |
@jomofcw Encode using base64, the question if it should be done automatically or not... |
@webimpress I understand. If I do it on my own, in your opinion, when and how shall I encode it base64 ? Something like that (but it sounds like wrong to me as it return something not human readable) :
|
provide complete standalone reproducer. taking things out of context is not reproducible, the line itself on it's own is not incorrect. likely the encoding in $message is not set to utf-8 for some reason. |
@glensc dunno if it's what you mean, but here is the method code where I build and send the message :
|
standalone means that if i take your script it actually runs in my environment. and it contains only necessary code to show the problem, nothing else. <?php
require 'vendor/autoload.php';
// YOUR CODE HERE |
Try this: $message->setFrom('my@mail.com', '=?UTF-8?B?'.base64_encode('HIDENAME Eugène').'?='); But as I said - maybe it should be done automatically inside the library... |
@webimpress it doesn't change anything (strange...). @glensc you'll find the code and the stack trace below :
Does it help, please ? |
yes. of course, because i was able to run the code on my machine. i created gist of your problem: https://gist.github.com/glensc/c3787087a9cd083fa3d7d071f0b450c2 (git clone to see history) but your fix is simple: @@ -18,7 +18,8 @@ array_push($message_parties,$html);
$corps = new Zend\Mime\Message();
$corps->setParts($message_parties);
-$message = new Zend\Mail\Message('utf-8');
+$message = new Zend\Mail\Message();
+$message->setEncoding('utf-8');
if this solved your problem, please close issue yourself. |
@jomofcw |
@glensc great ! it works ;-). I should have find it on my own, sorry for your time. |
Hello,
Using zend-mail module 2.9.0, I encounter an issue when using some special characters in headers.
Here is the stack trace of the error :
Do you need me to provide more ? Just ask !
Thanks for your work.
The text was updated successfully, but these errors were encountered: