我正在尝试使用php发送邮件,但邮件未显示在我的Gmail上。 $mail return true
。我正在使用hmailserver和WAMP。任何帮助将不胜感激。
$to = $_POST['to'];
$message = $_POST['Message'];
$from = $_POST['from'];
$cc = $_POST['cc'];
//$headers = "From: ".$_POST['from']."\r\n"."CC: ".$_POST['cc'];
$headers = 'From: Sigma Web Site <'.$_POST['from'].'>' . "\r\n" . 'Reply-To: ' .$_POST['cc']. "\r\n";
ini_set("sendmail_from", "iit@yahoo.com");
$mail = mail( $to, "Mail", $message, $headers);
echo($mail);
if($mail)
{
echo "Thank you for using our mail form";
}
else
{
echo "Mail sending failed.";
}
}
答案 0 :(得分:0)
试试这个;)。
$emailFROM = $_POST['from'];
$for = $_POST['to'];
$sub = "Subject";
$mes = $_POST['Message'];
if(Mail($for, $sub, $mes, "From: " . $emailFROM))
{
echo "(OK| <pre>$emailFROM<b>$for</b> - <b>$sub</b> - <b>$mes</b></pre>)";
} else {
echo "(Error)";
}