Using Azure Oauth in HostBill for sending emails

Create Azure Application

In the Azure portal, select Azure Active Directory and go to App registrations.

Then click New registration.

Set a Name and select Supported account types. In Redirect URI, select Web and set Redirect URL from HostBill. Press RegisterCopy Application (client) ID to Client ID in HostBill.

For the created application go to Certificates & secrets and then press New client secret. Copy Client Secret to HostBill.

Go to API permissions and Add a permission.

Add the following Scopes:

  • openid
  • email
  • offline_access

Go to Expose an API and Add a scope and Add a client application.

Set up Azure in HostBill

After creating Credentials, Client ID and Client Secret will be returned. These values must be set in HostBill in Mail Settings or in Additional mail senders.


  • SMTP Email address
  • SMTP Hostname
  • Port
  • Authentication to OAuth2
  • Provider to Azure

Then save the changes and press Connect. During authorization, log in to the account provided in the SMTP Email address. After successful Authorization, the Connection Token should be set.

SMTP Hostname should contain ssl:// or tls://

If messaging does not work after receiving an Access Token, make sure you have SmtpClientAuthentication enabled for Tenant. Visit for more information.

Error: Application is not configured as a multi-tenant application

Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.

Go to Azure Portal → Azure Active DirectoryApp registrations (preview) → Your AppAuthenticationSupported account types, and select Accounts in any organizational directory.

The Connection Token was generated correctly but the message could not be sent.

After pressing Connect you should be redirected to the login page and you should log in with your SMTP Email address account. If you are currently logged in to another account, the login page is skipped after pressing Connect. The authorization will succeed and the Connection Token will be generated correctly, but the SMTP will not work because the current account does not have access.

Follow these steps:

  1. Sign out of Azure/Microsoft.
  2. Go to SMTP configuration in HostBill.
  3. Press Disconnect.
  4. Then press Connect.
  5. You will be redirected to the login page, here you must log in to the account which is specified in SMTP Email address