How to Configure Microsoft Graph OAuth 2.0 for Email SMTP

How to Configure Microsoft Graph OAuth 2.0 for Email SMTP

Microsoft has deprecated basic SMTP authentication for most tenants. OAuth 2.0 via Microsoft Graph is now the recommended and more secure approach. This setup allows the app to send emails without storing mailbox passwords.

Step 1: Prerequisites

Before you begin, ensure the following are available:

⚠️ Note: Application permissions require admin consent and cannot be approved by regular users.


Step 2: Register an Application in Microsoft Entra ID

Step 1: Create App Registration

  1. Log in to Entra ID

  2. Navigate to: Applications → App registrations → New registration

  3. Fill in the form:

    • Name: Email OAuth

    • Supported account types: Single tenant

    • Redirect URI: Not required

  4. Click Register            

    Step 2: Capture App Identifiers

    After registration, copy and securely store the following values:

    • Directory (tenant) IDTENANT_ID

    • Application (client) IDCLIENT_ID

      Step 3: Create a Client Secret

      1. Open the registered application

      2. Go to: Certificates & secrets → Client secrets

      3. Click New client secret

      4. Define:

        • Description (e.g., SMTP OAuth Secret)

        • Expiration period (recommended: 12 or 24 months)

      5. Click Add

      ⚠️ Important: Copy the Value immediately. This will not be shown again.

      • Client Secret Value → CLIENT_SECRET

        Step 4: Assign Microsoft Graph API Permissions

        Step 1: Add Permission

        1. Go to API permissions

        2. Click Add a permission

        3. Select Microsoft Graph

        4. Choose Application permissions

        5. Search and select:

          • Mail.Send

        6. Click Add permissions

          1. On the API permissions page

          2. Click Grant admin consent for

          3. Confirm the action

          ✅ Status should show Granted for

          Step 5: Configure SMTP Email Settings in the Platform

          Once all Microsoft-side configuration is complete:

          1. Log in to the Web Application Admin Panel

          2. Navigate to: Admin → Reseller Settings → SMTP Email Settings

          3. Fill in the fields using the values obtained earlier

            Testing and Validation

            After saving the SMTP settings:

            1. Trigger a test email from the platform 

            2. Confirm:

              • Email is delivered successfully

              • No authentication errors appear at the top of the page

            3. If email fails:

              • Reconfirm Mail.Send permission

              • Ensure admin consent was granted

              • Verify sender mailbox exists and is licensed

                Troubleshooting

                Issue: Unauthorized or Invalid client

                • Confirm Tenant ID and Client ID are correct

                • Ensure secret value (not secret ID) is used

                Issue: Insufficient privileges

                • Mail.Send permission not granted

                • Admin consent missing

                Issue: Emails not received

                • Check spam/junk folder

                • Confirm sender address matches configured mailbox


    • Related Articles

    • How to Configure Gmail OAuth for Email SMTP

      OAuth (Open Authorization) is a protocol that allows users to grant third-party applications limited access to their resources without sharing their passwords. Gmail OAuth is commonly used to authenticate and access Gmail accounts securely. This ...
    • Add your SMTP/email sending address

      To enable email alerts and scheduled reports on the system you must input SMTP settings for an email account. You can do this in the Reseller SMTP settings section in the admin panel. Click on ADMIN, and then navigate to RESELLER SETTINGS. Under ...
    • Email History

      You can either view Email history at reseller level or client level At reseller level it shows all reseller and clients Email history At client level it is restricted to the client Email history only Click on ADMIN and navigate to Login,Email,Sms ...
    • Configure Inputs, Outputs & Sensors

      This article gives an overview of how to configure different types of inputs output and sensors You may want to create a fuel or temperature sensor mapping, add an engine cut off output, or map an input like door open close First you must add the ...
    • The user already exists - how to use the same email address for different logins

      You've tried to add a user account, but the platform gave you an error message saying the user already exists: "The user already exists" This happens when the email address already exists on the WLT platform, it might have already been used by ...