2014-03-05 62 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」

並檢查電子郵件是否沒有發送到垃圾郵件文件夾。