Database and Mail Configuration In Laravel

After installing the laravel, there is a .env file inside your project folder.
Open the .env file

Database Configuration

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead <--- change database “homestead” into your database name
DB_USERNAME=homestead <--- change username “homestead” into your MySQL username
DB_PASSWORD=homestead <--- change password “homestead” into your MySQL password

Mail Configuration

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io <--- change the host name
MAIL_PORT=2525             <--- change the port number according to host
MAIL_USERNAME=null         <--- change default username “null” into your mail username
MAIL_PASSWORD=null         <--- change default password “null” into your mail password
MAIL_ENCRYPTION=null       <--- change “null” into the tls (TLS)

Note:
For MAIL_HOST,
smtp.gmail.com” for gmail host
mail.domain.com” for domain host (If you buy the server)

If you want to use the gmail server for mail configuration:

Login to your gmail account and under My account > Sign In And Security > Sign In to google, enable two step verification, then you can generate app password, and you can use that app password in .env file.

MAIL_DRIVER= smtp
MAIL_HOST= smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME= test@gmail.com
MAIL_PASSWORD= gmailpassword
MAIL_ENCRYPTION=tls

After you make changes in your .env file, Run the command for removing the configuration cache => php artisan config:cache

I hope you understand and like this post. If you have any doubt regarding this post or other content regarding my site http://developerhelps.com/ .Please contact us.

Leave a comment

Your email address will not be published. Required fields are marked *

0 0 0
FOLLOW ON