1 回答

TA貢獻1786條經驗 獲得超13個贊
提供 JSON POST with PHP 鏈接。我這樣解決我的問題:
<?php
$data = json_decode(file_get_contents('php://input'), true);
if (!empty($data))
{
$to = '[email protected]';
$from = $data['email'];
$subject = utf8_decode($data['subject']);
$message = utf8_decode($data['message']) . utf8_decode("\n\n\n\n Ceci est un message envoyé depuis le formulaire de contact. Pour répondre à ce mail, envoyez un mail à l'adresse suivante : " . $from);
$headers = 'MIME-Version: 1.0\r\n';
$headers .= 'Content-type: text/html; charset=utf-8\r\n';
$headers .= 'To: Guyomar Alexis <[email protected]>\r\n';
$headers .= 'From: ' . ' <' . $from . '>\r\n';
mail($to,$subject,$message,$headers);
}
?>
現在一切都運行良好。
- 1 回答
- 0 關注
- 206 瀏覽
添加回答
舉報