Search code examples
google-apismtpgmailgoogle-oauthgmail-api

Gmail Authentication for sending mail


The user will enter Gmail account id and password in my page and that will be authenticated by google. I require password since I want to send Email using Gmail SMTP protocol.

I can use google developer user Authentication but still, I need the password for sending emails.

What should I do?


Solution

  • Google does not allow for Login and password authentication any longer. This is called client login. If you want there login and password just store that and don't bother authenticating it you will be able to access the GMAIL SMTP servers using that.

    Alternative would be to use Oauth2 and to use the Gmail API instead of going though the SMTP server. Note: Using Oauth2 to authenticate the user you will not get their password.