首页 文章

PHP Mail无法正常工作

提问于
浏览
0

我有一个很长的表格,表格的内容通过邮件发送(HTML电子邮件) .

我的PHP邮件功能完全适用于其他内容 . 但是,当我将以下内容添加到邮件正文时,邮件无法正常工作 .

<h4><span style="text-decoration:underline">OCCUPATION:</span></h4>

<p>Please provide a specific and identifiable business activity and
your current position . Vague references such as"Businessman" or
"Manager" will not be accepted and will delay the incorporation
process. In the case of no employment please describe the normal
day to day activities such as "House Wife" In case of retirement
please provide details of previous occupation and your last
position.
<textarea name="personal_information_occupation"> </textarea></p> <hr />

我经历了每一行,但找不到这些特殊线条的错误 .

我的PHP邮件发送HTML电子邮件 .

<?php

if(mail($to, $subject, $message, $headers)){
            $mail_status_message = "<p class='success-msg'> Form Submitted Successfully. </p>";
        }else{
            $mail_status_message = "<p class='error-msg'> Something went wrong. Please try again later. </p>";
        }

?>

基本上,当我将上述代码添加到邮件正文时,我得到 Something went wrong. Please try again later .

The mail headers are

$headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Additional headers
    $headers .= 'To: '.$to_name.'<'.$to_email.'>' . "\r\n";
    $headers .= 'From: Business Name <email@example.com>' . "\r\n";

1 回答

  • 0

    如果您的 mail() 函数调用返回FALSE并且您没有收到PHP错误,则表示您的邮件服务器出现问题 . 邮件正在发送到邮件服务器,但由于某种原因未被接受 . 究竟是什么原因取决于您的PHP服务器和邮件服务器的配置,因此您必须检查您的邮件服务器's logs to find out what'正在发生 . 见How can I get the error message for the mail() function?

相关问题