我在symfony 3上遇到swiftmailer问题我花了3天搜索问题没有任何结果 我想为我的web应用程序发送确认邮件,发送邮件的功能正常运行但与statut 302请求retun和日志错误:出现 异常而冲洗电子邮件队列:预期响应代码220,但得到的代码“”,与消息“”这样的邮件不会diliveredsymfony 3 swiftmalier不发送邮件
,这里是我的confugration文件
config.yml
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
encryption: ssl
port: 465
username: '%mailer_user%'
password: '%mailer_password%'
spool: {type: memory}
parameters.yml
parameters:
mailer_transport: smtp
mailer_host: smtp.mail.yahoo.com
mailer_user: [email protected]
mailer_password: test
secret: ThisTokenIsNotSoSecretChangeIt
和maillin行动
public function mailingAction()
{
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody("test mail");
//$mailer = $this->get('mailer')->send($message);
$this->get('mailer')->send($message);
,并感谢
在注释send()时动作是否工作?使用假脱机程序时,如果请求中稍后出现其他错误,它将不会发送电子邮件,请参阅:https://symfony.com/doc/current/email/spool.html#spool-using-memory“这意味着如果整个请求被执行而没有任何未处理的异常或任何错误,电子邮件只会被发送。“ – dbrumann