2017-06-14 156 views
1

試圖發送電子郵件與Swiftmailer,我得到了這個錯誤。我和配置swiftmailer:連接無法建立主機smtp.gmail.com

transport: smtp 
host: smtp.gmail.com 
username: [email protected] 
password: password 
port: 587 
encryption: ssl 

我總是收到此錯誤信息:

Connection could not be established with host smtp.gmail.com


我也試過用:

transport: gmail 
host: smtp.gmail.com 
username: [email protected] 
password: password 
port: 587 
encryption: ssl 

完整錯誤訊息是

[YYYY-mm-dd hh:ii:ss] app.ERROR: Exception occurred while flushing email queue: Connection could not be established with host smtp.gmail.com [ #0]


其他問題:

我的情況是this不同。在我的情況下,我沒有Avast殺毒軟件。


編輯:在

Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "my email address" using 1 possible authenticators

+2

端口587不是SSL。您可能需要端口465.請參閱[這裏](https://www.lifewire.com/what-are-the-gmail-smtp-settings-1170854)。 –

+0

您可能需要按照[此處]所述切換_「使用安全性較低的應用程序」_設置(https://stackoverflow.com/questions/29098781/script-sending-mails-with-gmail-failed-to-authenticate- SMTP服務器上)。 –

+0

已經完成。感謝您的建議。 – sensorario

回答

-1

改變端口465,亞歷克斯Howansky建議,埃羅改變它尋找服務器smtp.gmail.com但不能夠解決它。使用此域smtp.gmail.com和端口25或465.

+0

誰在尋找「mail.website.com」? – sensorario

+0

我編輯它是smtp.gmail.com –

+2

所以,...你建議將smtp.gmail.com:465更改爲smtp.gmail.com:465。有趣。 – sensorario

0

1:要麼您必須允許不太安全的應用程序或使用應用程序的密碼,通過啓用2步驗證您的gmail acc。 2:禁用你的機器上的任何防病毒(這是沒有人會告訴你,但在許多情況下是必要的)。 3:不要忘記清除緩存(有時它不會從.env文件中獲取更新的內容) 4:您不需要在配置目錄中的Mailer中更改任何內容(不推薦),您應該使用env變量

相關問題