我无法让文件假脱机与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来实际发送电子邮件,但我不确定这些电子邮件是否正在进行后缀,因此可能没有任何区别。
答案 0 :(得分:0)
问题最终成为默认环境。我需要做的就是指定一个除了
之外的环境php app/console swiftmailer:spool:send --env=prod