Php 脚本使用不同的时间戳发送两次邮件,尽管只调用一次


Php script sending mail twice with different timestamp although called just once

我读过很多帖子,主题像我的标题快递。但是对我没有帮助,我完全陷入困境。我正在使用以下代码块:

function acceptCallbackData() {
    $body = "test";
    $subject = "Message sent by php";
    $to = "a-person@parascus.de";
    $header  = 'MIME-Version: 1.0' . "'r'n";
    $header .= 'Content-type: text/html; charset=utf-8' . "'r'n";
    $header .= 'From: another-person@parascus.de' . "'r'n";
    $from = "another-person@parascus.de";
    $host = "xxxx";
    $username = "xxxx";
    $password = "xxxx";
    $headers = array ('From' => $from, 'Subject' => $subject, 'Content-type' => 'text/html; charset=utf-8');
    require_once "Mail.php";
    $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password));
    $mail = $smtp->send($to, $headers, $body);
    $_SESSION["ERRORS"] = "";
    exit();
}

我认为"To"的地址只存在一次(不在调用和标头中),exit() 确保(Firebug 也告诉我)这个脚本/函数只执行一次。

但我仍然收到邮件的时间,也可以有不同的时间戳。有什么建议可以解决这个问题吗?

此致敬意

寄生虫

调试PHP邮件时(从前端javascript/jQuery/etc.客户端发送时)的第一件事是从等式中删除客户端。

您可以自行调用 php 函数并重现重复的邮件吗?如果没有,那么您的问题出在前端。如果是这样,那么你需要找到在你的php代码中复制函数的位置。

在本例中,我们确定它确实是客户端。