\\
!1. Google Mail OAuth 2.0\\
\\
__Google Mail__ through __SMTP__/__IMAP__ requires __OAuth 2.0__ ([OAuth Wikipedia Link|https://en.wikipedia.org/wiki/OAuth]) for authentication. (More information : [Google IMAP-SMTP Link|https://developers.google.com/gmail/imap/imap-smtp]).\\
\\
__!!! Proxy Configuration:__ If your server accesses the internet through a proxy, make sure to whitelist the following domains for Google Mail Authentication:\\	
• oauth2.googleapis.com\\
\\
Start by navigating to Google APIs & Services: [Google APIs & Services Link|https://console.developers.google.com/projectselector/apis/credentials]\\
__!!!Note:__ Ensure sure the __GMAIL API__ is enabled at __Enabled APIs & services__. [Google API Library Link|https://console.cloud.google.com/apis/library]\\
\\
[SMTP Google Mail Integration/g_api_services.png]\\
\\
[SMTP Google Mail Integration/gmail_api_enabled.png]\\
\\
Go to the __Credentials__ menu, click on __Create Credentials__, and select __OAuth client ID__:\\
\\
[SMTP Google Mail Integration/create_credentials.png]\\
\\
Select the application type: __Web application__. Provide a unique name. Then, configure the __Authorized redirect URI__—this is where Google will redirect you after authorization. The Redirect URL must end with __?command=register_google_mail_api__.\\
\\
{{{

    http://127.0.0.1:9090/?command=register_google_mail_api
}}}\\
or
{{{
    
    https://your.crushftp.domain.com/?command=register_google_mail_api
    
}}}\\
Finally, click the __Create__ button.\\
\\
[attachments|credential_config.png]\\
\\
After the credentials are created, copy the __Client ID__ and __Client Secret__.\\
\\
[SMTP Google Mail Integration/client_id_secret.png]\\
\\
Now if your credentials are setup, and your redirect domains are configured, you can use the credentials in CrushFTP to get your google auth token and get access.\\
__CrushFTP admin page url must match with the redirect url.__ In our example: http://XXXXcrushftp.com\\
In the Preferences -> General Settings -> SMTP Settings, at __username SMTP Server Username put your google email address. Then click "Get mail refresh token" to get the "SMTP Server Password"__. Put your client id and secret on the appeared form.\\
[attachments|oauth_form.png]\\
\\
If your domain is not verified you will get a warning message, click on Advanced and proceed further:\\ 
\\
[SMTP Google Mail Integration/not_verified_domain.png]\\
\\
Click on allow:\\
\\
[SMTP Google Mail Integration/allow_form.png]\\
\\
Once it is finished the "SMTP Server Password" input field will be filled with the refresh token.\\
\\
[SMTP Google Mail Integration/smtp_config.png]\\
\\