我无法使文件后台处理与Symfony 2和Swiftmailer正常工作。
这是我的配置
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool:
type: file
path: '%kernel.root_dir%/spool'
port: %mailer_port%
encryption: %mailer_encryption%
sender_address: %mailer_sender_address%
当我发送电子邮件时,会在app/spool/default/中创建一个文件
然后我运行
php app/console swiftmailer:spool:send
并得到这个响应
[2015-12-29 18:54:40] Processing default mailer... 1 emails sent
因此,它看起来已经工作了,但没有发送任何内容,/var/log/mail.log也没有显示任何新的电子邮件。
当我将配置设置为内存假脱机时,电子邮件工作正常,没有任何问题,我只更改了config.yml
swiftmailer:
spool: { type: memory }
更改为
swiftmailer:
spool:
type: file
path: '%kernel.root_dir%/spool'
我使用sendgrid和postfix来实际发送电子邮件,但我不确定这些电子邮件是否经过了postfix,所以这可能没有什么区别。
问题最终成为默认环境。我所需要做的就是指定一个开发之外的环境
php app/console swiftmailer:spool:send --env=prod