PHP邮件脚本不发送电子邮件

时间:2014-07-22 00:43:42

标签: php email

好人和女孩,

我一直绞尽脑汁想弄清楚我错过了什么。我有一个脚本,它接受一个表单并将其插入到数据库中,然后向我发送一封电子邮件,以便创建一个管理员用户。问题是,当我转储邮件功能时,我得到一个假的,没有电子邮件。

$adminEmail = $user->email;
$adminName  = $user->name;

// Creates Email for user Creation.

$to         = "To: David <admin@myDomain.com>";
$subject    = "NEW User needs to be created.";
$message = "
    <html>
        <head>
            <title>New User</title>
        </head>
        <body>
            <table>
                <tr>
                    <th>Organization Name</th>
                    <td>" . $org_name . "</td>
                </tr>
                <tr>
                    <th>Organization Code</th>
                    <td>" . $newOrgCode . "</td>
                </tr>
                <tr>
                    <th>Organization Contact</th>
                    <td>" . $this->mktGetTypeValue($org_con_prefix) . " " . $org_con_fName . " " . $org_con_lName . "</td>
                </tr>
                <tr>
                    <th>Contact Email</th>
                    <td>" . $org_con_email . "</td>
                </tr>
            </table>
        </body>
    </html>
";

$headers    = "MIME-Version: 1.0\r\n";
$headers    .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers    .= "From: Org User Setup <userSetup@myDomain.com>\r\n";
$headers    .= "Reply-To: $adminName <$adminEmail>\r\n";
$headers    .= "Subject: {$subject}\r\n";
$headers    .= "X-Mailer: PHP/".phpversion() . "\r\n";

mail($to, $subject, $message, $headers);

var_dump(mail($to, $subject, $message, $headers));

代码正确插入数据库。我也没有收到任何错误。

任何帮助都会很棒。

0 个答案:

没有答案