我正在商业网站上创建申请表。应用程序需要发送到一个带有两个扩展名的电子邮件地址(不确定正确的术语:.ns.ca)示例Admin@halifaxwildlife.ns.ca。
我的php没有出现日志错误,并且在发短信时,提交者确实收到了确认电子邮件,上面的电子邮件显示在TO:字段中。然而,该电子邮件永远不会被收到。
当我更改TO:电子邮件时,只需.com或.ca扩展名,表单就可以了。
如何设置我的服务器或php以容纳这个独特的电子邮件地址?
<?php
// Fetching Values from URL.
$firstname = $_POST['firstname1'];
$lastname = $_POST['lastname1'];
$address = $_POST['address1'];
$email = $_POST['email1'];
$phone = $_POST['phone1'];
$regular = $_POST['regular1'];
$family = $_POST['family1'];
$crest = $_POST['crest1'];
$email = filter_var($email, FILTER_SANITIZE_EMAIL); // Sanitizing E-mail.
// After sanitization Validation is performed
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!preg_match("/^[0-9]{10}$/", $phone)) {
echo "<span>* Please Fill Valid Contact No. *</span>";
} else {
$subject = $firstname + $lastname + "HWA Application";
// To send HTML mail, the Content-type header must be set.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:' . $email. "\r\n"; // Sender's Email
$headers .= 'Cc:' . $email. "\r\n"; // Carbon copy to Sender
$template = '<div style="padding:50px; color:white;">Hello ' . $firstname . $lastname . ',<br/>'
. '<br/>Thank you...! For Contacting Us.<br/><br/>'
. 'Name:' . $firstname + $lastname . '<br/>'
. 'Address:' . $address . '<br/>'
. 'Email:' . $email . '<br/>'
. 'This is a Contact Confirmation mail.'
. '<br/>'
. 'We Will contact You as soon as possible .</div>';
$sendmessage = "<div style=\"background-color:#7E7E7E; color:white;\">" . $template . "</div>";
// Message lines should not exceed 70 characters (PHP rule), so wrap it.
$sendmessage = wordwrap($sendmessage, 70);
// Send mail by PHP Mail Function.
mail("admin@HalifaxWidlife.ns.ca", $subject, $sendmessage, $headers);
echo "Your Query has been received, We will contact you soon.";
}
} else {
echo "<span>* invalid email *</span>";
}
?>
答案 0 :(得分:0)
这最终成为GoDaddy的区域文件问题。复杂的问题让他们处理。我结束了使用gmail创建一个单独的电子邮件帐户,该帐户会自动将任何应用程序转发到正确的电子邮件。不理想,但这很好用。