Does
$name
contain non ASCII characters?
Then the subject must be encoded as noted in the
PHP: mail - Manual[
^]:
Quote:
Caution Subject must satisfy » RFC 2047[^].
Example to create an encoded subject string:
$encoded_subject = "=?UTF-8?Q?".quoted_printable_encode($subject)."?="