Guides & TutorialsSystem Settings MailSetting Up Google As Your Mail Service Provider

Setting Up Google As Your Mail Service Provider

OAuth provides access your mail provider, and is more secure than traditional username-and-password authentication. Some mail providers are requiring OAuth, or have announced a requirement for it in the future.

WHMCS includes Google OAuth support in version 8.0 and later.

To use OAuth via Google with WHMCS, you will need to both configure Google as your mail service provider and create an app for it in the Google Cloud console.

Set up Google in WHMCS

To set Google up as your Service Provider, go to Configuration > System Settings > General Settings > Mail and click Configure Mail Provider.

Select SMTP as your Mail Provider and choose a Mail Encoding. Then, select Google as your Service Provider.

Enter smtp.gmail.com for the SMTP Host and 465 for the SMTP Port. Select Oauth2 for SMTP Authentication.

For SMTP Username, enter the Gmail address that you will be using in your application. 

For instructions generating the Client ID and Client Secret at Google, refer to the Create your Google Application section below

Copy-and-paste the Client ID and Client Secret from the Google Cloud Console into the appropriate boxes. These will display in the confirmation message, or go to Credentials and click the edit icon for the appropriate OAuth 2.0 Client IDs:

Next to Connection Token, click Connect. (There should not be a value in Connection Token yet.)

In the Google Choose an account screen, select the account that you used to create the app.

Follow the prompts to approve access for your account. If you see a This app isn't verified. error, click Advanced and then click Go to at the bottom of the window.

When you finish this, the system will automatically enter a token in Connection Token. To make sure that your configuration works, click Test Configuration.

Click Save. The system will test your configuration again when you save.

Create your Google application

To use Google as your service provider, you will need to create an app. This will let you connect to Google via WHMCS. If you have already used Google Cloud's console, you may not need to perform some of these steps, or interfaces may not look like the screenshots below.

First, go to the Google Cloud console. If you haven't before, select your country and agree to Google's Terms of Service.

Go to APIs and Services > Credentials.

In the top-right corner, click Create Project. Enter a Project Name and choose a Location. Then, click Create.

Click Create Credentials and select OAuth client ID.

Click Configure Consent Screen.

Select External for User Type, and then click Create. It's important to note that this indicates that the generated client ID will be usable by anyone, but only after you go through a verification process. However, when creating a client ID that's only for use with WHMCS, you do not need verification.

Enter the information on the OAuth consent screen. Use the default Scopes, and make sure to add your WHMCS domain to the list of Authorized domains.

Click Save and your new app is complete.

You must also create the client ID itself. In the left sidebar, click Credentials. Click Create Credentials and select OAuth client ID again.

For the Application Type, select Web Application.

Enter a name for your application. Then, under Authorized redirect URIs, click Add URI.

In the box that appears, enter the Callback URL from within WHMCS.

Click Create. A confirmation message will appear, with the Client ID and Client Secret to use in the steps above.

You can now continue configuring SMTP with OAuth 2.0 (see the section above).