My PHPMailer relevant options are configured like this:
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->SMTPAuth = true;
$mailer->CharSet = "UTF-8";
$mailer->isHTML(true);
Then, if i try to send an email to my hotmail.com account, with some emojis in the subject field like this:
$foo = "\xF0\x9F\x94\xA5 text \xF0\x9F\x94\xA5";
$mail->Subject = $foo;
$mail->Body = "<p style='font-size:100px'>Mail body: $foo</p>";
The mail is sent ok and the word "text" surrounded by two little fire emojis appears correctly in the email subject. The mail body appears correctly also:
. If i try this:
$foo = "\xF0\x9F\x94\xA5 text text \xF0\x9F\x94\xA5";
$mail->Subject = $foo;
$mail->Body = "<p style='font-size:100px'>Mail body: $foo</p>";
again subject and body appears correctly:
but if i add another "text" word:
$foo = "\xF0\x9F\x94\xA5 text text text \xF0\x9F\x94\xA5";
$mail->Subject = $foo;
$mail->Body = "<p style='font-size:100px'>Mail body: $foo</p>";
then this happens:
so the subject emojis are replaced with 4 question marks each (the 4 bytes comprising the emoji unicode character maybe?)
What is happening?


