Guides & TutorialsTroubleshootingTroubleshooting Support ToolsBad Request Error Importing Microsoft® Email

Bad Request Error Importing Microsoft® Email


WHMCS fails to import emails using a Microsoft email service (for example, Microsoft Outlook® or Microsoft 365®).

Additionally, admins with the System email permission receive a POP3 Connection Error email with the following error detail:

Bad Request


The Redirect URI that you specified during app registration in the Microsoft Azure® Portal is invalid. It does not resolve to the callback handler file in your WHMCS installation.

This may be due to one of several causes:

  • The WHMCS System URL setting in WHMCS begins with http://.
  • You have misconfigured WHMCS's Friendly URL settings.
  • The WHMCS installation URL changed after you registered the app.


To resolve this issue:

1. Make certain that you have installed a valid SSL certificate on your website.

2. Update the WHMCS System URL setting to use https:// in the General tab at Configuration > System Settings > General Settings.

For more information on updating the system URL, see Updating the System URL.

3. Re-synchronise your .htaccess file and confirm that Full Friendly Rewrite mode operates correctly.

For more information, see Updating the .htaccess file.

4. Edit the support department at the Configuration > System Settings > Support Departments.

5. Under Mail Importing Configuration, copy the new Redirect URL value.

6. Update your app registration in the Microsoft Azure Portal to use the new redirect URL.

The redirect URL must use the following format, where is your website and whmcs is the directory that stores WHMCS's files:

For more information, see Create Your Microsoft Azure Application.