点击提交按钮时未收到邮件

时间:2015-04-18 11:11:05

标签: php

我试图向多个用户发送邮件...如果我使用两个Gmail邮件ID意味着我将正确收到邮件..如果我尝试使用像info@xxx.com这样的邮件意味着我将不会收到邮件它将显示错误消息..我今天必须做,请任何人帮助我。

这是我的编码:

<?php
$name = $_POST["name"]; 
$lname = $_POST["lname"]; 
$email = $_POST["email"]; 
$location = $_POST["location"]; 
$org = $_POST["org"]; 
$inquiry = $_POST["inquiry"]; 
$message = $_POST["message"]; 
$message = "Name :" . $name . "\n" 
         . "Last Name :" . $lname . "\n" 
         . "Email :" . $email . "\n" 
         . "Location :" . $location . "\n" 
         . "Organization :" . $org . "\n" 
         . "Inquiry :" . $inquiry . "\n" 
         . "Questions/Comments  :" . $message;

$subject = "Visitor Enquiry";
$to = "dev@xxxcom";
$to = "info@XXx.com";

if(mail($to, $subject, $message)){ ?>
<script>
    alert("Thank You for Contacting Us,We'll Get Back To You Soon");
    window.location = "contact-us.php";
</script>
<?php
echo "We Received Your enquiry, We'll get back to you soon";
} else { 
echo "There were some errors sending enquiry, please try again";
}
?>

1 个答案:

答案 0 :(得分:1)

bool mail (string $to , string $subject , string $message 
           [, string $additional_headers [, string $additional_parameters]])

如果$ to是有效的邮件地址,那么肯定会收到邮件