How can I send an email formatted as "Name <user@example.com>
" to:
??????¥μàá?????éê?í??Dòó???ùüY?àáa???èé?ìí??e?ó????ù?y? <user@example.com>
Obviously, many of these characters will never show up in a name, but in case they do, I would prefer that they do not prevent an email from being successfully sent.
Currently, this fails as noted in Apache's error.log with
Ignoring invalid 'To:' recipient address
'¥μàá??????èéê?ìí??D?òó????ùú?üY?àáa?????èéê?ìí??e?òó????ùú?üy?
' Transaction aborted: no recipients specified
If possible, I would like to keep the special characters 'as they are.'
Otherwise, can I use some sort of transliteration function to clean-up the name?
Example of usage:
<?php
$to = "???????¥μàá??????èéê?ìí??D?òó????ùú?üY?àáa?????èéê?ìí??e?òó????ùú?üy? <CHANGED@gmail.com>";
$subject = "Test Subject";
$body = "Test Body";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…