Problem
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:
Bad Request
Cause
The URL that you specified during app registration in the Microsoft Entra® ID (formerly 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:
- Your WHMCS System URL setting begins with
http://
. - You have misconfigured the Friendly URL settings.
- The WHMCS installation URL changed after you registered the app.
Solution
To resolve this issue:
- Make certain that you have installed a valid SSL certificate on your website.
- Update the WHMCS System URL setting to use
https://
in the General tab at Configuration () > System Settings > General Settings.For more information, see Update the System URL. - Resynchronise your
.htaccess
file and confirm that Full Friendly Rewrite mode operates correctly. To do this:- Go to the General tab at Configuration () > System Settings > General Settings.If the
404
error prevents you from accessing Configuration () > System Settings, type the filename into your browser’s URL bar:configgeneral.php
- Scroll to the Friendly URLs section. You may see that this setting is being manually overridden.
- By default, WHMCS will detect and pick the best option for your server environment.
- If it has been manually overridden, there may be a problem in your configuration.
- Click Advanced Settings to the right of the Friendly URLs menu. A new window will display important URI-related information. You may see an indication that Full Friendly Rewrite did not pass the environment mode tests:
- Click the Rewrite File tab. If you see an OUT OF SYNC message under WHMCS Rules, the
.htaccess
rules are out-of-date: - Enable Auto-Managed Rewrite to ensure that the rules stay up-to-date in the future.
- Click Synchronize to close the window.
- Click the Refresh icon for Friendly URLs to refresh the menu. If the issue is resolved, Full Friendly Rewrite will display in the menu and the sections that displayed the
404
error will be accessible again.
- Go to the General tab at Configuration () > System Settings > General Settings.
- Edit the support department at the Configuration () > System Settings > Support Departments.
- Under Mail Importing Configuration, copy the new Redirect URL value.
- Update your app registration in the Microsoft Entra portal to use the new redirect URL.The redirect URL must use the following format, where
example.com
is your website andwhmcs
is the directory that stores WHMCS’s files:https://example.com/whmcs/admin/setup/mail/oauth2/callback
For more information, see Set Up Email Importing - Microsoft.
Last modified: October 29, 2024