开发者

symfony 1.4 adding a BCC recipient to mailer

开发者 https://www.devze.com 2022-12-24 19:27 出处:网络
I know w开发者_运维百科ith swift directly you can create a Recipient_List and do ->addBcc() . How would i do this same thing in the context of symfony 1.4

I know w开发者_运维百科ith swift directly you can create a Recipient_List and do ->addBcc() . How would i do this same thing in the context of symfony 1.4

$message = $this->getMailer()->compose();
$message->setSubject(sfConfig::get('app_email_welcome_subject'));
$message->setTo($user->getUsername());
$message->setFrom(sfConfig::get('app_email_from'));


compose() return a Swift_Message object, you can use setBcc() or addBcc() methods as you would with swift


if you use symfony 1.4 .your code can set

         $message = Swift_Message::newInstance();
         $message->setSubject($subject);
         $message->setFrom($from);
         $message->setBody($body);

         $transport = Swift_SmtpTransport::newInstance(sfConfig::get('app_email_host'), sfConfig::get('app_email_port'), 'ssl')
            ->setUsername(sfConfig::get('app_email_username'))
            ->setPassword(sfConfig::get('app_email_password'));
        $mailer = Swift_Mailer::newInstance($transport);

when use it can send email use gmail....

i think you can!

example: http://swiftmailer.org/docs/sending.html

0

精彩评论

暂无评论...
验证码 换一张
取 消