Pear Mail Going Very Slow (10 seconds to send)

元气小坏坏 提交于 2019-12-24 23:28:59

问题


A similar question has been asked before by someone else, but there were no answers.

I am sending two emails using Pear Mail, but when debugging why my script was going slow, I discovered it was taking an avg of 10.34 seconds to send both emails.

Am I not setting something that I should? Anything I can change?

Here's my code:

$sendMail = sendMail($to, $subject, $message_body);

function sendMail($to, $subject, $message_body)
{
    $headers["From"] = "<my from address>";
    $headers["To"] = $to;
    $headers["Reply-To"] = "<my reply to>";
    $headers["Subject"] = $subject;
    $headers["Content-type"] = "text/html";
    $params["username"] = "<my username>";
    $params["password"] = "<my password>";
    $params["host"] = "<my host>";

    $mail_object =& Mail::factory("smtp", $params);
    $sent = $mail_object->send($headers["To"], $headers, $message_body);

    if (PEAR::isError($sent)) {
        return "Could Not Send Email Alerts. Please try submitting your request later.";
    }

    return 1;
}

回答1:


It's likely that the receiving server is performing anti-spam checks on you. These could include reverse DNS checks, blacklist checks (i.e., RBLs), content scanning, and throttling. If you can run a network sniffer to watch the traffic, you might get a clue as to what is happening. You might also want to contact the administrator of the server you're connecting to, and ask what checks are being performed and what rules you might be able to adhere to in order to avoid (or quicken) some of them.




回答2:


check that your server has reverse DNS set up. it could be that the receiving server is trying to verify your identity, and can't resolve your IP address to a name.



来源:https://stackoverflow.com/questions/8143858/pear-mail-going-very-slow-10-seconds-to-send

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!