【问题标题】:SwiftMailer Sends Mail Very SlowlySwiftMailer 发送邮件非常缓慢
【发布时间】:2013-03-23 04:47:26
【问题描述】:

我正在使用 WAMP 服务器在我自己的计算机上开发我的 php 网站。我正在使用 Swiftmailer 发送邮件。它发送邮件,但它的工作非常缓慢。它在大约 8-12 秒内发送一封邮件。 我正在使用以下代码

   $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com',465, 'ssl');
    $transport->setUsername('xyzmail@gmail.com');
    $transport->setPassword('xyz12345');

    $message = Swift_Message::newInstance();
    $message->setTo("myownemail@gmail.com");
    $message->setSubject("Test Mail from News Page");
    $message->setFrom("xyzmail@gmail.com");
    $message->setBody("This is the Message Body");

    $mailer = Swift_Mailer::newInstance($transport);

    if($mailer->send($message))
    {
        $output_msg = "Message Has been Sent Successfully!";
    }
    else
    {
        $output_msg = "Could Not Sent Message!";
    }

我在这里提到的一件事是,我没有在消息正文中发送太多文本,而是发送与上面示例中相同的单行文本。

为什么它工作这么慢,我有什么问题吗?还是我需要使用任何其他邮件发送工具?

【问题讨论】:

    标签: php email swiftmailer


    【解决方案1】:

    不确定 SwiftMail 是否是这里的问题。

    也许服务器配置不允许更快地发送电子邮件。当我在共享服务器中时,我遇到了这样的问题。

    因为快速发送电子邮件(即每 0.5 秒)会使服务器过载,因此服务器管理员已配置为每 10 秒发送一封电子邮件。

    另一个原因可能是垃圾邮件安全。

    【讨论】:

    • 如果我有 VPS,如何配置我的服务器以发送快速电子邮件。
    猜你喜欢
    • 2011-12-29
    • 2017-09-13
    • 2015-10-18
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 2019-02-10
    • 2015-04-16
    相关资源
    最近更新 更多