2017-08-01 87 views
0

場景:我有一個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起來在我的最後,在打開正確的端口之外?或者還有什麼我可以做的嗎?

回答

0

這個工作對我來說:

mailer_transport: gmail 
mailer_host: 'smtp.gmail.com' 
mailer_user: '[email protected]' 
mailer_password: 'somesecurepassword' 
相關問題