Guides & TutorialsSupport Tools Email PipingSetting Up POP3 Importing with OAuth via Google

Setting Up POP3 Importing with OAuth via Google

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 8.1 added support for OAuth email importing via Google.

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

Create Your Google Application

To use Gmail as your service provider, you will need to create an app. This will let you connect to Gmail 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 Redirect URL from within WHMCS.

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

Set up Gmail in WHMCS

To set POP3 importing, go toConfiguration > System Settings > Support Departments.

Enter your support department information in the Add New Department section of the page. Then, under Mail Importing Configuration, select Google as your Service Provider. The system will automatically set the Hostname as pop.gmail.com.

Select OAuth2 for Authentication. Several text boxes will appear.

For Email Address, enter the Gmail address that you used in your application.

For instructions to generate the Client ID and Client Secret, refer to the Create your Google Application section above.

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 you can go to Credentials and click the edit icon for the appropriate OAuth 2.0 Client IDs:

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

In the Google Choose an account screen that appears, 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, WHMCS will automatically enter a token in Connection Token.

Click Save. The system will test your configuration again when you save, and then you will be ready to start using email importing.