$to = 'user@xxx.com' . ', ';
$subject = '信件標題';
$message = '內容';
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\n";
$headers .= 'From: sender@xxx.com' . "\n";
if(!mail($to, $subject, $message, $headers)){
die("send error!");
}else{
echo "send mail ok!";
}
如果$from $to $msg資料是透過$_POST或$_GET取得
則需加""處理
mail("$to", "$subject", "$message", $headers)
沒有留言:
張貼留言