我正在尝试假脱机电子邮件,当涉及到swiftmailer
假脱机文件路径时,我感到困惑,我不确定从哪里获得路径?如果有人能给我指明正确的方向,提前谢谢!
因为当我尝试运行这个命令时,
php app/console swiftmailer:spool:clear-failures --env=prod
它给了我这个错误
"The parameter "swiftmailer.spool.file.path" must be defined"
//这里的路径该怎么办
$spoolPath = $this->getContainer()->getParameter('swiftmailer.spool.file.path');
我在这里叫它吗?
# app/config/config.yml
swiftmailer:
# ...
spool:
type: file
path: /path/to/spooldir
如何在我的文件夹中找到这个/path/to/spooldir
目录?我很困惑
编辑:我在这里使用这个例子
swiftmailer假脱机文件路径
第一个:
#app/config/config.yml
swiftmailer:
#...
spool:
type: file
path: "%mailer_spool_path%"
第二:
#app/config/parameters.yml
parameters:
#...
mailer_spool_path: '%kernel.root_dir%/spool'
您可以通过以下方式访问此参数(在命令中):
$spoolPath = $this->getContainer()->getParameter('mailer_spool_path');
希望它能帮助你。。。