尝试使用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'), ],