嘗試使用mailtrap發送電子郵件...我在本地主機上成功實現了它並且工作正常,但是在部署到heroku後我無法讓它在實時伺服器上工作。請問解決辦法是什麼
這是我的 .env
檔案中的 smtp 設定
MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=31239f96d871e7 MAIL_PASSWORD=***** MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS="browynlouis2@gmail.com" MAIL_FROM_NAME="${APP_NAME}"
這就是完全在我的heroku中的情況
P粉2933419692023-10-31 00:31:39
對於託管伺服器等即時伺服器,請變更 smtp 的 .env 設定
#............................................... .... ........................................... ........... ......................
Mail_Mailer=smtp
Mail_Host=smtp.hostinger.com
Mail_Port=465
Mail_Username=example@domain.com
Mail_Password=密碼
Mail_cryption=ssl
Mail_From_Address=example@domain.com
MAIL_FROM_NAME="${APP_NAME}"
然後轉到config/mail.php將傳輸方式smtp更改為mail
#'mailers' => [ 'smtp' => [ 'transport' => 'mail', //before it was smtp 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, 'local_domain' => env('MAIL_EHLO_DOMAIN'), ],