Laravel 9: Expected response code "250/251/252" but received error message "550 5.7.1 Relaying denied" with code "550"
P粉752812853
P粉752812853 2023-10-30 10:54:18
0
1
827

Trying to send an email using mailtrap... I successfully implemented it on localhost and it works fine, but after deploying to heroku I can't get it to work on the live server. What is the solution?

This is the smtp settings in my .env file

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}"

This is exactlywhat it looks like in my heroku

P粉752812853
P粉752812853

reply all(1)
P粉293341969

For live servers such as hosting servers, change the .env settings for smtp

................................................................. ......................................................................... ........................................

Mail_Mailer=smtp

Mail_Host=smtp.hostinger.com

Mail_Port=465

Mail_Username=example@domain.com

Mail_Password=Password

Mail_cryption=ssl

Mail_From_Address=example@domain.com

MAIL_FROM_NAME="${APP_NAME}"

Then go to config/mail.phpChange the transport method smtp to 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'),

    ],
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!