寄信標題支援中文問題, 避免因為標題中文寄信失敗

rusli
Site Admin
文章: 212
註冊時間: 週三 7月 07, 2010 9:49 pm

寄信標題支援中文問題, 避免因為標題中文寄信失敗

文章rusli » 週二 12月 06, 2016 10:31 pm

<?php
$to = "rusli@rusli.cloudns.org";
$email = $_REQUEST['email'];
$subject = $_REQUEST['name'];
$comment = $_REQUEST['message'];


mb_internal_encoding('UTF-8');
$encoded_subject = mb_encode_mimeheader($subject, 'UTF-8', 'B', "\r\n", strlen('Subject: '));


if (isset($_REQUEST['email'])) {
mail($to, $encoded_subject, $comment, "From:" . $email);
echo "Thank you for contacting us!";
}
else {
echo "\"email\" variable is not filled out";
}
?>

回到「php」

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 0 位訪客