【问题标题】:email sent successfully but no email received and not in spam using swiftmailer使用 swiftmailer 成功发送电子邮件但未收到电子邮件且不在垃圾邮件中
【发布时间】:2015-05-20 05:29:01
【问题描述】:

我正在使用 Swiftmailer。虽然邮件在本地成功接收,但它不能在现场工作,虽然消息是“邮件发送成功”。 代码:

require_once APPPATH.'swiftmailer/swift_required.php';

        try {
            $transport = Swift_MailTransport::newInstance();
            // Create the Mailer using your created Transport
            $mailer = Swift_Mailer::newInstance($transport);

            // Create a message
            $message = Swift_Message::newInstance($email_subject)
                ->setFrom(array('xxx@yyy.org' => 'xxx'))
                ->setTo(array('abc@gmail.com' => ''))
                ->setBody($email_message, 'text/html');

            // Send the message
            $result = $mailer->send($message);
            $message = array('type' => 'success', 'message' => 'Email Sent successfully.');

        } catch(Exception $e) {
            echo '<pre>'; echo $e; die;
            $message = array('type' => 'danger', 'message' => $e);
       }

欢迎任何帮助/建议。

【问题讨论】:

    标签: php email swiftmailer


    【解决方案1】:

    电子邮件发送成功显示,因为 php 的功能是将邮件传递到根据您在 php.ini 文件中的配置运行的邮件服务器。是否发送邮件是邮件服务器的工作。如果您的邮件服务器配置不正确,则不会发送邮件,但会显示成功,因为邮件功能将邮件发送到服务器,现在邮件服务器的工作是发送邮件与否。所以检查你的邮件服务器的日志。

    【讨论】:

      猜你喜欢
      • 2013-10-17
      • 1970-01-01
      • 2012-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-11
      相关资源
      最近更新 更多