When you send mail using Gmail SMTP service then google block your authentication and mail not send to the receiver. Now let's check why and how we can resolve this problem.
What is SMTP and Why use Gmail SMTP?
Ans. SMTP means Simple Mail Transfer Protocol, it just a protocol which gives some rule and regulation to send mail to each other. Here proper authentication is performed for mail will send to an actual person.
There are many SMTP service provider on the market on the best site is
- SendinBlue.
- Mailgun
- SendGrid
- Amazon SES
- G Suite
- Postmark
- Office365
These are the best SMTP provider but it is not free. It takes some fees so we use Gmail SMTP which is free to use.
Why we need mail send feature?
- User authentication
- password reset
- success message send
- user login credentials like user id and their password
Gmail Integration problem
Gmail block authentication
In Gmail there are multiple security features are present like 2-step verification third-party authentication. These make a problem when we try to use Gmail SMTP in our project.
After writing the code and run an error is shown in that error a link is given.
This error is shown because our Gmail has the security feature called "Less secure app access" that is turned on so that Gmail block authorize device which accesses the Gmail using username and password to send mail.
How to solve authentication problem in Gmail SMTP?
- Singin Gmail account and click manage our google account
- on the right sidebar click security
- search Less secure app access and open it
- Now on the less secure app access