Swiftmailer从控制台发送,但不是从PHP发送
我有以下代码来发送邮件:Swiftmailer从控制台发送,但不是从PHP发送,php,symfony,email,swiftmailer,dovecot,Php,Symfony,Email,Swiftmailer,Dovecot,我有以下代码来发送邮件: /* Emails */ $message = \Swift_Message::newInstance() ->setSubject('Ihre Sammelrechnung') ->setFrom("xxx@myserver.com") ->setTo("recipient@gmail.com") ->setBody( $this->rende
/* Emails */
$message = \Swift_Message::newInstance()
->setSubject('Ihre Sammelrechnung')
->setFrom("xxx@myserver.com")
->setTo("recipient@gmail.com")
->setBody(
$this->renderView(
'email/invoiceMultiFinal.html.twig', array(
'company' => 'COMPANY',
)
),
'text/html'
);
/* Send eMail */
if(!$this->get('mailer')->send($message)){
die("ERROR");
}
我100%知道发件人和收件人是正确的。在我的日志中,我有:
{“message”:“刷新电子邮件队列时发生异常:无法使用用户名\在SMTP服务器上进行身份验证”xxx@myserver.com\“使用1个可能的验证器”,“上下文”:[],“级别”:400,“级别名称”:“错误”,“频道”:“应用程序”,“日期时间”:{“日期”:“2016-05-31 15:19:09.919207”,“时区类型”:3,“时区”:“欧洲/柏林”},“额外”:[]}
config.yml
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory } #Deleting this changes nothing
参数.yml
parameters:
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: xxx@myserver.com # adding "" doesn't change sth either
mailer_password: password
secret: xxxxxxx
我使用的是我自己的服务器,所以不涉及Gmail等。我可以通过webmailer和php-bin/console-swiftmailer:email:send发送和接收电子邮件
你知道什么会导致这种行为吗?旁注,它像一个符咒一样工作了将近一个月!它今天停止了,可能与重新启动有关 是否可能应用程序正在prod模式下运行,并且需要清除缓存以重新加载SMTP设置。是否可能应用程序正在prod模式下运行,并且需要清除缓存以重新加载SMTP设置。