2012-07-31 19 views
0

,但它不工作,消息在symfony的假脫機/應用/緩存/ swiftmailer /卷軸,但是當我做COMMANDE PHP應用程序/ console swiftmailer:spool:發送消息被從spool中刪除但沒有發送,控制檯中的輸出是:發送0封電子郵件,有人可以告訴我問題在哪裏?這是我的config.yml:消息是假脫機,但我使用的是swiftmailer Symfony2中發送一些樣品的消息沒有發送

swiftmailer: 
    transport:   smtp 
    username:    ~ 
    password:    ~ 
    host:     localhost 
    port:     false 
    encryption:   ~ 
    auth_mode:   ~ 
    spool: 
     type:     file 
     path:     "%kernel.cache_dir%/swiftmailer/spool" 
    sender_address:  ~ 
    antiflood: 
     threshold:   99 
     sleep:    0 
    delivery_address:  ~ 
    disable_delivery:  ~ 
    logging:    "%kernel.debug%" 

這裏是我的代碼:

$message = \Swift_Message::newInstance() 
    ->setSubject('Hello Email') 
    ->setFrom('[email protected]') 
    ->setTo('[email protected]') 
    ->setBody($this->renderView('ProjetAccountBundle:Main:email.txt.twig')) 
; 
$this->get('mailer')->send($message); 

return $this->render('ProjetAccountBundle:Main:test.html.twig'); 
} 

回答

0

的問題是使用SMTP,而不是郵件中,COR rect配置文件對我來說是這樣的:

swiftmailer: 
    transport:   mail 
    username:    ~ 
    password:    ~ 
+1

這並不是爲什麼你的郵件假脫機。它必須處理,但是配置了smtp。 – Incognito 2013-06-10 20:02:46