开始时根本不发送电子邮件,但后来我在函数中使用了“-f”参数,然后它可以发送到外部地址(到目前为止已测试过 Gmail 和 Hotmail),但它不适用于地址虽然在域上。只是想知道它是在代码中还是服务器设置有问题?
if ($Valid == 1) {
$_POST = array_map('strip_tags', $_POST);
$_POST = array_map('stripslashes', $_POST);
$To = "user@domain.ca";
$Subject = "Online Driver Application";
$Body = "All the values of the form that was filled out (removed because there was a lot and it doesn't affect the problem)";
$Headers = 'MIME-Version: 1.0' . "\r\n";
$Headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$Headers .= 'From: Company <info@domain.ca>' . "\r\n";
$Headers .= 'Reply-To: no-reply@domain.ca' . "\r\n";
$Headers .= 'X-Mailer: PHP/' . phpversion();
mail($To, $Subject, $Body, $Headers, -finfo@domain.ca);
echo '<div class="success">Thank You! Your form has been successfully submitted.</div>';
} else {
if ($ErrorMsg != '') {
echo '<div class="error">'.$ErrorMsg.'</div>';
}
同样,除非我在邮件功能中有 -finfo@domain.ca,否则根本不会发送电子邮件。
谢谢。