1. Home
  2. Docs
  3. Ultimate Flutter Grocery Delivery
  4. Required Settings
  5. Email SMTP Setup

Email SMTP Setup

In this tutorial, we will discuss how to configure our Laravel applications to send emails using your Gmail account as a Gmail SMTP server with the default Laravel SMTP configurations.

The benefits of using an SMTP server cannot be over-emphasized, with an SMTP server we can send emails from our local server. Thus, giving us the ability to test the email functionality on the local server itself. Mails sent via SMTP are not flagged as SPAM by Gmail as seen in emails sent using the PHP default mail() function.

Step 1:

Open cPanel And Open your API code. and edit .env file

Step 2:

Configure Gmail SMTP Server in Laravel Application

Laravel uses config/mail.php file for storing details used in mail sending. This file contains settings like MAIL_DRIVER, MAIL_HOST, MAIL_PORT, etc. In order to successfully send an email, we need to provide this information.

To add this required information, we need not edit this config/mail.php file, rather we would supply these details accordingly in the .env file.

Thus, open your .env file which is located in your root directory of our application and checkout for these settings:


Now edit the details above as follows.

In the above settings, we configured MAIL_DRIVER as SMTPMAIL_HOST for Gmail as smtp.googlemail.comMAIL_ PORT for Gmail as 465, and MAIL_ENCRYPTION method as SSL.

The MAIL_USERNAME and PASSWORD should be replaced with your Gmail Email address and Password respectively.

Step 3:

Make sure you are not using GMAIL SMTP, because they have closed the smtp service

You are done!!

Was this article helpful to you? Yes No

How can we help?