Swiftmailer/gmail未能使用用户名进行身份验证,使用2个可能的身份验证器
场景:我有一个Symfony 3.3网站,一旦成功填写并提交了联系表单,就需要将外发电子邮件发送到特定的电子邮件地址。在与sendmail DNS问题(你可以看到here)战斗后,我决定改变策略并使用Gmail的SMTP服务器发送邮件。然而,在冲洗阀芯,我收到以下错误:Swiftmailer/gmail未能使用用户名进行身份验证,使用2个可能的身份验证器
15:04:31 ERROR [console] Error thrown while running command "swiftmailer:spool:send --env=prod". Message: "Failed to authenticate on SMTP server with username "[email protected]" using 2 possible authenticators" ["error" => Swift_TransportException { …},"command" => "swiftmailer:spool:send --env=prod","message" => "Failed to authenticate on SMTP server with username "[email protected]" using 2 possible authenticators"] [] 15:04:31 ERROR [console] Command "swiftmailer:spool:send --env=prod" exited with code "1" ["command" => "swiftmailer:spool:send --env=prod","code" => 1] []
我config.yml
:
# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
port: '%mailer_port%'
encryption: '%mailer_encryption%'
spool:
type: file
path: '%kernel.cache_dir%/swiftmailer/spool'
而且parameters.yml
:
mailer_transport: smtp
mailer_host: 'smtp.gmail.com'
mailer_user: '[email protected]'
mailer_password: 'somesecurepassword'
mailer_port: 587
mailer_encryption: 'tls'
我需要做任何设置TLS起来在我的最后,在打开正确的端口之外?或者还有什么我可以做的吗?
这个工作对我来说:
mailer_transport: gmail
mailer_host: 'smtp.gmail.com'
mailer_user: '[email protected]'
mailer_password: 'somesecurepassword'