web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Smtp Mail CreateMessage AddFrom

(0) ShareShare
ReportReport
Posted on by 911

My employer is running a legacy version of Business Central (On-Prem) - Spring '19 Release, and has no immediate plans to upgrade. My question is about the 'From Address' when using codeunit 'Smtp Mail (400)' (yes, I know it's marked for removal), specifically the first two arguments of the CreateMessage procedure: FromName: Text; FromAddress: Text. and the AddFrom procedure that is subsequently called. The FromName is being obeyed, but the FromAddress is not. For test purposes on my Sandbox I'm using my Google GMail account with an App password (settings below) and I'm sending from the current user name & address
(in this case: ADMIN admin@M365x83076759.OnMicrosoft.com).

anydesk00139_5F00_BC_5F00_SMTP_5F00_Cropped.png

At the destination, the email headers seem to indicate that the original FromAddress had initially been set:-
From: ADMIN <nwebb767@gmail.com>
X-Google-Original-From: ADMIN admin@M365x83076759.OnMicrosoft.com

But, it appears to eventually use the 'Send mail as' value from my Gmail settings for the FromAddress

pastedimage1647265637744v1.png

I tried configuring my gmail settings to send as another email address (a process that involved 2-step verification). I then ended up receiving an unsatisfactory ‘On behalf Of’ sender hybrid as below:-

Nicholas Webb <nwebb767@gmail.com>; on behalf of; nick@webb-web.co.uk (ADMIN) <nick@webb-web.co.uk>

Why is the FromAddress specified at point of message-creation being ignored / overridden?

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    Business Central will determine which address to display in the following order:

    1. The address specified in the E-Mail field on the Approval User Setup page for messages in a workflow.

    2. The address specified in the Send As field in the SMTP Email Setup page.

    3. The address specified in the User ID field in the SMTP Email Setup page.

    Hope it helps.

    Thanks.

  • Nick Webb Profile Picture
    911 on at

    Thanks for your response. Does this mean that the FromAddress parameter of the CreateMessage procedure in the "Smtp Mail" codeunit is ignored?

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    I do not exactly know how Gmail handles this but the SMTP user account / FromAddress is being used to do the authentication. This does not need to be the same address that is associated with the account that is sending the mail.

    Hope it helps.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 554 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 360 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 201 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans