PHP mb_send_mail

user-pic
Vote 0 Votes

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

About this Entry

This page contains a single entry by Pank published on May 15, 2014 10:46 AM.

pinglog was the previous entry in this blog.

Google Geocoding API limit is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives