Laravel & Php

How to integrate Zoho SMTP Mail Configurations in Laravel?


zoho smtp

The integration was quite simple. All you need to do is to set the Mail Configuration in the ENV of Laravel.

Still, it took us an entire day to make it work. Why?
As the information was quite scattered. I find out a few things from some different places, a few from the document and that’s how it finally started to work.
In this blog, I am writing out all the difficulties I’ve faced which will help you to do this task in a few minutes.
To send the email you need to configure the following parameters-

MAIL_DRIVER
This is easy, use the default value which is SMTP.

MAIL_HOST
If you do a google search or follow the Zoho document, you see everywhere that you need to use smtp.zoho.com as a MAIL_HOST.
But here is a little catch please do check in which region your account is created. For me, the account is in the Indian region so I need to use smtp.zoho.in instead of smtp.zoho.com.

MAIL_ENCRYPTION
The mail encryption can be SSL or TLS.

MAIL_PORT
The mail port will depend on MAIL_ENCRYPTION. For SSL choose 465 and for TLS you need to set the MAIL_PORT to 587.

MAIL_FROM_ADDRESS & MAIL_USERNAME
Both parameters will have the same value. The values should be the email address of the Zoho account.

For MAIL_USERNAME, there is no information about what should be the value of this parameter. The example you’ll see will provide a dummy value example@zoho.com but what you need to use is simply the email address of your Zoho account.

MAIL_PASSWORD
At many places, you’ll find that you need to use the password of your account but you need to use an app-specific password. You’ll need to generate an App Specific address from your Zoho account dashboard
Here is the detailed procedure you need to follow to generate the App-Specific Password
App Specific Password

So here’s the final look of your MAIL Configuration

MAIL_DRIVER=smtp
MAIL_HOST=smtp.zoho.in // check your account region
MAIL_ENCRYPTION=SSL
MAIL_PORT=465
MAIL_FROM_ADDRESS=youremail@gmail.com
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD=123456

Laravel
Share with Friends

Like this chef? Share with friends..