SwifMailer setBcc或setTo不起作用

时间:2018-08-19 08:30:45

标签: php symfony swiftmailer

这是我的代码:

SELECT initems.itemno,
       COUNT(initems.itemno) OVER (PARTITION BY initems.itemno)
       * SUM(initems.qty) OVER (PARTITION BY initems.itemno)
FROM InvItems AS initems
WHERE initems.type = '3' 

这是相同代码的另一种实现方式

$mailer = new \Swift_Mailer($transport);

$message = (new \Swift_Message('Hello Email'))
    ->setSender('my email id', 'my name')
    ->setBody(
        $this->renderView(
            'AppBundle:Mail:email.html.twig',
            array('result' => $result)
        ),
        'text/html'
);

$message->setTo(array($customerEmail => 'jhon doe'));
$message->setBcc(array($clientEmail => 'jhon doe 1'));
$mailer->send($message)`

在两种情况下,$mailer = new \Swift_Mailer($transport); $message = (new \Swift_Message('Hello Email')) ->setSender('my email id', 'my name') ->setTo(array($customerEmail => 'jhon doe')) ->addBcc($clientEmail, 'jhon doe 1') ->setBody( $this->renderView( 'AppBundle:Mail:email.html.twig', array('result' => $result) ), 'text/html' ); setTo()都有效,但两者都不起作用,任何人都可以帮我解决这个问题。

我使用gmail作为邮件服务器,我已经尝试了ssl和tls的配置。

0 个答案:

没有答案