带有UTF-8 PHP的电子邮件标题[重复]

I want to put UTF-8 characters in the from part of an email.

Every part of the message is UTF-8 and it's working correctly except the FROM part.

I'm using this:

//boundary
    $div = "==Multipart_Boundary_x".md5(time())."x";
    //headers
    $head = "From: $name
".
        "MIME-Version: 1.0
".
        "Content-Type: multipart/mixed;
".
        " boundary=\"$div\"";

$name has UTF-8 characters and I can display correctly it in the message body.

I have tried with "\xEF\xBB\xBF" .$name" and still it's not working.

What am I doing wrong?

</div>

Don't reinvent the wheel, use some library:

http://swiftmailer.org/

http://framework.zend.com/manual/1.12/en/zend.mail.html

there are others