Setting Up Google As Your Mail Service Provider
WHMCS comes with the ability to send emails without any additional configuration using PHP mail(). While this works in most cases, other mail providers may give you a better experience and access to additional features.
WHMCS 8.0 added support for Mailgun, SendGrid, and SparkPost in addition to support for SMTP as well as added support for Google OAuth with SMTP. WHMCS 8.6 and later also include Microsoft services. For more information, see:
Set up Google in WHMCS
To configure Google, you will need to create an app in the Google Cloud console and configure the mail provider in the Mail tab at Configuration > System Settings > General Settings.
Select SMTP as your Mail Provider and choose a Mail Encoding. Then, select Google as your Service Provider.
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).