- The data is correct?
- Config cache renewed?
Apr 18, 2023
3
Level 5
Laravel 10 - Sending Email Issue in Production
Hello.
I have been trying to send email using the same credentials I have used in my development server (which is working well), but in the Production server (Cpanel), I am getting:
Symfony\Component\Mailer\Exception\TransportException Failed to authenticate on SMTP server with username "[email protected]" using the following authenticators: "LOGIN", "PLAIN". Authenticator "LOGIN" returned "Expected response code "235" but got code "535", with message "535 Incorrect authentication data".". Authenticator "PLAIN" returned "Expected response code "235" but got code "535", with message "535 Incorrect authentication data".".
With the same credentials running in local server works fine.
Things that I have tried:
// env
MAIL_MAILER=smtp // tried sendmail | mail
MAIL_HOST=smtp.gmail.com // tried zoho smtp too
MAIL_PORT=587
[email protected]
MAIL_PASSWORD="**********"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
Changed config/mail.php to
// mail.php
'mailers' => [
'smtp' => [
'transport' => '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'),
'verify_peer' => false, // this to false
],
...
]
Tried clearing cache and configs.
It would be great help, If anyone can help me out. Thanks is advance.
Level 5
If anyones is having the same issue like mine. Here the solution.
The WHM that I had as default had SMTP restrictions enabled. So to disable SMTP restrictions, follow the following steps:
- Login to WHM.
- Go to
Security Center. - Click
SMTP Restrictions. - Click
Disableto disable theSMTP restrictions.
Please or to participate in this conversation.