我无法将表单数据发送到电子邮件(我不是PHP专家)
if(isset($_POST['submit'])){
if(!($_POST['company'] && $_POST['email'] && $_POST['comment'])){
echo "<font color='red'>Please insert all Fields</font>";
}
else{
$recipient = "blah@gmail.com";
$mail_to = "oyon.ctg@gmail.com";
$subject = "Contact Mail";
$message = "
Name\n
$_POST[company]\n
Email Address\n
$_POST[email]\n
Comment\n
$_POST[comment]\n
";
$email_from = "$_POST[email]";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($mail_to,$subject,$message,$headers);
}
答案 0 :(得分:0)
<?
if(isset($_POST['submit'])) {
if(!isset($_POST['company']) && !isset($_POST['email']) && !isset($_POST['comment'])) {
echo "<font color='red'>Please insert all Fields</font>";
} else {
$recipient = "blah@gmail.com";
$mail_to = "oyon.ctg@gmail.com";
$subject = "Contact Mail";
$message = " Name\n ".$_POST['company']."\n Email Address\n ."$_POST['email']."\n Comment\n ".$_POST['comment']."\n ";
$email_from = $_POST['email'];
}
}
mail($mail_to, $subject, $message, $headers);
?>