mik*_*ike 5 swiftmailer symfony symfony-2.7
我无法让文件假脱机与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%
Run Code Online (Sandbox Code Playgroud)
当我发送电子邮件时,会在app/spool/default /中创建一个文件
然后我跑了
php app/console swiftmailer:spool:send
Run Code Online (Sandbox Code Playgroud)
得到这个回应
[2015-12-29 18:54:40] Processing default mailer... 1 emails sent
Run Code Online (Sandbox Code Playgroud)
所以它看起来有效,但没有发送任何内容,并且/var/log/mail.log没有显示任何新的电子邮件.
当我将配置设置为内存假脱机时,电子邮件工作没有任何问题,我更改的是config.yml
swiftmailer:
spool: { type: memory }
Run Code Online (Sandbox Code Playgroud)
变成
swiftmailer:
spool:
type: file
path: '%kernel.root_dir%/spool'
Run Code Online (Sandbox Code Playgroud)
我正在使用sendgrid和postfix实际发送电子邮件,但我不确定电子邮件是否甚至到了postfix,所以这可能没有任何区别.
问题最终出在默认环境上。我所需要做的就是指定一个除 dev 之外的环境
php app/console swiftmailer:spool:send --env=prod
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
921 次 |
| 最近记录: |