Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anuzpandey's avatar

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.

0 likes
3 replies
Muetze's avatar
  • The data is correct?
  • Config cache renewed?
anuzpandey's avatar

@Muetze Yes. The same thing works in local environment. So data are all correct. And yes Config are cleared and cached. I even double checked it with tinker.

anuzpandey's avatar
anuzpandey
OP
Best Answer
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 Disable to disable the SMTP restrictions.

Please or to participate in this conversation.