Background
Break News
How to add local font to Tailwind Css and NextJS? - Tutorial Design Pattern? - Blockchain Technology, How to create own Bitcoin virtual currency - Zustand mordern management state - Design Pattern - Flyweight Pattern? - Docker Full training Topic

[PHP - LARAVEL] Using Gmail SMTP Server to send Email in Laravel

Tuesday, 14 July 2020
|
Read: Completed in minutes

[PHP - LARAVEL] Using Gmail SMTP Server to send Email in Laravel

Hello everyone, welcome back to Learn Tech Tips blogspot.

Topic today is show you how to using gmail SMTP server to send mail in Laravel.
At times the simplest things are the most complicated. Here I would be making the very first attempt to further simplify the simpler things . So lets get started :
I would divide this implementation into 2 parts :

Step 1: Creating / Using an existing Gmail account to create app passwords.
Step 2: Adding the Gmail account details to the Laravel Application.

Let check step 1 first:
Step 1: Creating / Using an existing Gmail account to create app password:
I would be using my existing Gmail account , but in case if you wish to create a new account , you can do so using this Link

Next we need to enable 2 step Verification in Gmail as follows:
Login into Gmail .
To be able to create app passwords we need to first enable 2 Step Verification .
Click on the user icon and select “Google Account” .
Next we need to select Security from the left nav , then select “2 Step Verification” . (Doing this would ask you to login again and then Gmail would authenticate you further using OTP )

Using Gmail SMTP Server to send Email in LaravelAdd caption





Now we generate the app password that we would be using in the Laravel Application , again clicking on the Google Account in the user icon ->Security ->App Passwords . (This would again ask you to login and then authenticate using OTP)


We need to select “Mail” as the app and “Other (Custom name)” as the device from the drop downs .

Selecting this would ask you to add the name of the Application for which you wish to generate the password and once added click GENERATE.


Using Gmail SMTP Server to send Email in Laravel


This would open a pop up with your 16 character app password . (Kindly copy this and keep it safe).
We are all set to add these detail’s to the Application.

Step 2: Adding Gmail Account detail’s to the Laravel Application:
We need to edit the following in the .env file

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null


with

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=youraccount@gmail.com
MAIL_PASSWORD=yourapppassword
MAIL_ENCRYPTION=ssl


NOTE: There is no need for us to make any change in the config/mail.php file

If you got question or feeback, free feel to leave your comment at below this blog.
Many thanks!

Zidane


πŸ™‡πŸΌπŸ™‡πŸΌ Your Feedback Is Valuable and Helpful to Us - Webzone, all things Tech Tips web development Zidane
Popular Webzone Tech Tips topic maybe you will be like it - by Webzone Tech Tips - Zidane
As a student, I found Blogspot very useful when I joined in 2014. I have been a developer for years . To give back and share what I learned, I started Webzone, a blog with tech tips. You can also search for tech tips zidane on Google and find my helpful posts. Love you all,

I am glad you visited my blog. I hope you find it useful for learning tech tips and webzone tricks. If you have any technical issues, feel free to browse my posts and see if they can help you solve them. You can also leave a comment or contact me if you need more assistance. Here is my blog address: https://learn-tech-tips.blogspot.com.

My blog where I share my passion for web development, webzone design, and tech tips. You will find tutorials on how to build websites from scratch, using hot trends frameworks like nestjs, nextjs, cakephp, devops, docker, and more. You will also learn how to fix common bugs on development, like a mini stackoverflow. Plus, you will discover how to easily learn programming languages such as PHP (CAKEPHP, LARAVEL), C#, C++, Web(HTML, CSS, javascript), and other useful things like Office (Excel, Photoshop). I hope you enjoy my blog and find it helpful for your projects. :)

Thanks and Best Regards!
Follow me on Tiktok @learntechtips and send me a direct message. I will be happy to chat with you.
Webzone - Zidane (huuvi168@gmail.com)
I'm developer, I like code, I like to learn new technology and want to be friend with people for learn each other
I'm a developer who loves coding, learning new technologies, and making friends with people who share the same passion. I have been a full stack developer since 2015, with more than years of experience in web development.
Copyright @2022(November) Version 1.0.0 - By Webzone, all things Tech Tips for Web Development Zidane
https://learn-tech-tips.blogspot.com