PHP mb_send_mail
Subject and message are automatically encoded,
to and additional_headers are not automatically encoded.
mb_send_mail 比 mail 好用很多, 主旨及本文會自動依 mbstring.internal_encoding 處理編碼
但是當 to and additional_headers 有包含 multi-byte 時, multi-byte 部份要用 mb_encode_mimeheader 處理過才會正常
e.g.
$to=mb_encode_mimeheader("王大頭")." <foo@test.com>";
$additional_headers="From: ".mb_encode_mimeheader("王小頭")." <bar@test.com>\nContent-Type: text/plain; charset=UTF-8";
mb_send_mail($to,$subject,$message,$additional_headers);
Leave a comment