我正在尝试从联系表单发送邮件以发送到Gmail地址帐户。我的问题是,当我使用雅虎电子邮件地址时,它不会向收件人发送gmail地址帐户但是当使用gmail地址帐户发送给收件人时,gmail地址帐户看起来很好..
像这样....<?php
if (isset($_POST['contact_name']) && isset($_POST['contact_email']) && isset($_POST['contact_num']) && isset($_POST['contact_text'])){
$contact_name = $_POST['contact_name'];
$contact_email = $_POST['contact_email'];
$contact_num = $_POST['contact_num'];
$contact_text = $_POST['contact_text'];
if (!empty($contact_name) && !empty($contact_email) && !empty($contact_num) && !empty($contact_text)){
$to = 'jeffgamasan@gmail.com,life1trading@gmail.com';
$subject = 'Contact form submitted';
$body = $contact_name."\n".$contact_text. "\n" .$contact_num;
$headers = 'From: '.$contact_email;
if (@mail($to, $subject, $body, $headers)){
echo "<script>window.location.href='thankyou.php'</script>";
}else{
echo "<script>window.location.href='error.php'</script>";
}
}else{
echo "<script>window.location.href='error.php'</script>";
}
}
?>