Symfony 消息是假脱机的,但不发送
我正在使用symfony2和swiftmailer发送一些示例消息,但它不起作用,消息在symfony/app/cache/swiftmailer/spool中进行假脱机处理,但当我执行命令php app/console swiftmailer:spool:send时,消息会从假脱机中删除,但不会发送,控制台中的输出是:发送0封电子邮件,有人可以告诉我问题出在哪里?这是我的config.yml:Symfony 消息是假脱机的,但不发送,symfony,swiftmailer,Symfony,Swiftmailer,我正在使用symfony2和swiftmailer发送一些示例消息,但它不起作用,消息在symfony/app/cache/swiftmailer/spool中进行假脱机处理,但当我执行命令php app/console swiftmailer:spool:send时,消息会从假脱机中删除,但不会发送,控制台中的输出是:发送0封电子邮件,有人可以告诉我问题出在哪里?这是我的config.yml: swiftmailer: transport: smtp us
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('test@gmail.com')
->setTo('myadress@gmail.com')
->setBody($this->renderView('ProjetAccountBundle:Main:email.txt.twig'))
;
$this->get('mailer')->send($message);
return $this->render('ProjetAccountBundle:Main:test.html.twig');
}
问题是使用smtp而不是邮件,我的正确配置文件是:
swiftmailer:
transport: mail
username: ~
password: ~
这不是你的邮件被假脱机的原因。这与smtp的配置方式有关。