Others

How to Change the Office 365 SMTP Email Display Name Dynamically

John WilsonJohn Wilson Oct 26, 2026 869 views

Question details

The user needs to dynamically change the sender display name for emails sent through Office 365 SMTP via a custom application.

How to Dynamically Change the Office 365 SMTP Email Display Name
Product
Office 365 SMTP
Device & OS
not provided
Scenario
Sending automated invoices from an application on behalf of multiple customers using a shared sender email address.
Observed behavior
The custom display name set by the application's code is ignored by Microsoft-hosted Office 365 and reverts to the default account display name, despite working previously on GoDaddy-hosted Office 365.
Before you start

Verify your application's programming language, authentication method (OAuth or Basic), and current SMTP library before modifying your email-sending architecture.

Solution 1Recommended

Migrate from SMTP Client Submission to Microsoft Graph API

Microsoft Exchange Online enforces strict sender address policies for standard SMTP. Using the Microsoft Graph API provides more flexibility for custom sender details.

Microsoft-hosted Office 365 tenants often enforce security policies that strip dynamic display names submitted via traditional SMTP to prevent email spoofing. Migrating to the Microsoft Graph API is the recommended approach for modern enterprise applications.

1
Register your application in Azure AD

Log in to the Azure portal, navigate to Azure Active Directory, and register a new application to obtain your Client ID and Tenant ID.

2
Grant Mail.Send permissions

Under API permissions, add Microsoft Graph and select the 'Mail.Send' application permission. Ensure admin consent is granted for the tenant.

3
Construct the JSON email payload

In your application code, construct the email message using the Graph API format. Under the 'from' or 'sender' object, specify the 'emailAddress' containing both the routing 'address' and your dynamic 'name'.

4
Send via HTTP POST request

Use your preferred programming language to send a POST request to 'https://graph.microsoft.com/v1.0/users/{id}/sendMail' passing your configured JSON payload.

Migrate from SMTP Client Submission to Microsoft Graph API
API Rate Limits: Be mindful of Microsoft Graph API rate limits when sending bulk automated invoices to avoid throttling.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite? Try WPS Office

While WPS Office does not manage email server configurations or SMTP relay routing, it provides a comprehensive, free alternative for creating, editing, and designing the invoice documents your application sends out.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Install the application: Run the installer and follow the on-screen prompts to set up WPS Office on your device.
  3. 3. Open your invoice templates: Launch WPS Writer or Spreadsheets to open, edit, and export your professional invoice documents without losing formatting.
Completely free and lightweight office suiteHigh compatibility with Microsoft Office formats (DOCX, XLSX, PPTX)Built-in PDF tools for easy invoice creation and exportFamiliar and intuitive user interface for seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

Why does Microsoft-hosted Office 365 strip my custom sender display name?

Microsoft enforces strict anti-spoofing and security policies on its native hosted Exchange environments. By default, it often rewrites the sender display name to match the authenticated directory user to prevent phishing, unlike some legacy or third-party hosted setups (like GoDaddy) which may have more permissive default connector settings.

Can I use basic authentication for SMTP client submission?

Microsoft has deprecated Basic Authentication for Exchange Online. You must transition your application to use OAuth 2.0 authentication for SMTP client submission, or switch to the Microsoft Graph API.

Is it possible to dynamically override the 'Reply-To' address instead?

Yes. While Office 365 strictly controls the 'From' display name, it generally allows custom applications to dynamically set the 'Reply-To' header without stripping the information. This is a common workaround if customers need to reply directly to a specific department or account manager.