How to use google SMTP in top recommend way

Hi Guys,

Today we will discuss regarding getting SMTP details for our projects from google.

Its suggested on many sites that we can use our gmail username and password as SMTP credentials along with other required parameters which we need to write in our SMTP configurations parameters ie:

SMTP 
    username: Your Gmail email address
    password: Your Gmail password
    server address: smtp.gmail.com
Gmail SMTP port (TLS): 587
SMTP 
    port (SSL): 465
    TLS/SSL required: yes

So according to above details, sometime these details works but sometime as compare to latest versions of code or libraries it gives us error something similar to “535-5.7.8 username and password not accepted”.

And to fix that error we have a alternate, Which we are going to discuss here.

First of all we have to visit our google’s manage your account section by visit the url https://myaccount.google.com/

After visiting google’s my account page, next you have visit Security menu in left bar of the page by visit this URL https://myaccount.google.com/security

Then you have to enable the “2-step verification” from the right section of the page where you can see a block with the heading “Signing in to Google”.

While enabling this “2-step verification” feature there will be chance that you have to login to your google account multiple times.

Once you are done with enabling “2-step verification”, you are free to visit back the security page again to proceed on further step. Which is “App Password”.

Strange thing is that this option was not visible/available for those accounts those have not enabled “2-step verification”.

App Password

Ok Now we are going to set “App Password”.

Which will be even required for our purpose of setting SMTP.

Sorry to keep you occupied that long with other details, But these were required to reach this step.

Further moving forward towards our goal, Now you can see the “App Password” option.

Click on it and you will moved to a page where you have to choose options to set “App Password”.

Again you might have to login to google/gmail account to access this “App Password” panel.

There will be options given to choose from are “Select app” and “Select Device”.

These 2 options will have separate list of options to select any option from the list as per requirement.

In my case, where I have to use for my website, I choose “Other (Custom Name)” and a text field will appear to write custom name for the reference of “Other (Custom Name)”.

So when you are done with writing your custom name, Click on the button with text “Generate”.

After that, page will save your provided name details and a popup(something similar to below image) will appear with the password generated text will be highlighted in yellow background along with details like “Heading” and “How to use it”.

Above text (highlighted in yellow background) will be used as a password value for used SMTP credentials.

Note: In spite of, if you try to write this password yourself in your code instead of copy paste from here, Mind that you have to ignore the spacing given in the provided password and write it without any space.

Final Step

After using email address as username and above generated password from “App Password” from “Google Account” as password.

In addition to, along with other SMTP parameters in code.

Finally, email functionality will start working with provided SMTP details.

Other than above mentioned methods.

There could be few more great way to achieve the goals of making SMTP works for different types of project.

Besides this, in fact if you want to learn more related to SMTP details, to illustrate it can be seen here

Read Here: If you want to get Git Basic Commands List Simple Helpful

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.


Posted

in

by

Comments

Leave a Reply

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

7 × one =