2014-03-05 61 views
0

在config.yml的Symfony2在我的控制器发送电子邮件不工作

# Swiftmailer Configuration 
swiftmailer: 
    transport: sendmail 
    username: %mailer_user% 
    password: %mailer_password% 
    disable_delivery: false 

$from = $data['email']; 
//$sento = self::getSiteInfo()->getEmail(); 
$sento = '[email protected]';        
$message = \Swift_Message::newInstance() 
    ->setSubject('Nouveau message') 
    ->setFrom($from) 
    ->setTo($sento) 
    ->setBody(
     $this->renderView(
      'RootSiteBundle:Front:email.txt.twig', 
      array('data' =>$data) 
     ) 
    ); 
$this->get('mailer')->send($message); 
+0

请你可以添加更多关于错误消息的详细信息/是将它发送到邮件队列的电子邮件吗? – BillyBigPotatoes

+0

有没有错误信息!,但电子邮件没有发送 – jsf

+0

你也使用什么版本的'swiftmailer'? 'v.2.3.2'中有'sendmail'的错误。看到这个[问题的细节](http://stackoverflow.com/questions/19911648/symfony2-swiftmailer-sendmail-transport-error)。 – ferdynator

回答

0

解决方案是使用 “的symfony/swiftmailer束”: “2.3.2”

并检查电子邮件是否没有发送到垃圾邮件文件夹。