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

Community site session details

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

Current User Email Account

(0) ShareShare
ReportReport
Posted on by 891

If BC is configured to use the 'Current User' Email Account and a Job Queue runs a codeunit that sends an email what would the sender email address be?

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Current User Email Account

    Hi,

    It would take a current default email account user as a sender.

    Thanks.

  • Nick Webb Profile Picture
    891 on at
    RE: Current User Email Account

    Thanks for your response. So, let's say it's 1 O'clock in the morning. No-one is logged in and there's a scheduled Job Queue about to run that is going to send an email. There's only one email account setup and it's of 'Current User' type, where would the default email account user be read from when the Job Queue runs?

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Current User Email Account

    Hi,

    Please visit Email Account page, and you find an email Address field, which you had setup during Email Account setup, it will be used as a sender email id.

    pastedimage1654773363278v1.png

  • Nick Webb Profile Picture
    891 on at
    RE: Current User Email Account

    Again, thanks for your response. If the Email Account is of type: 'Current User', the Email Address displayed on your screenshot changes to whoever is logged in (e.g.) user01@testdomain.com, user02@testdomain.com etc. So my question above remains.

  • Suggested answer
    MahGah Profile Picture
    15,529 on at
    RE: Current User Email Account

    Hi Nick

    it is all depends.

    The email that you selected as default in email setup page is the email that send an email if no scenario did not defined.

    If Current User is a default email then BC uses the email of the person how last time Set the Status of Job Queue to Ready (Job Queue Entry under User ID).

    But it is possible codeunit has a default email chard coded. In this case it will use that email address.

  • Nick Webb Profile Picture
    891 on at
    RE: Current User Email Account

    When you choose 'Current User' in the email setup page you don't get to select an email address it just displays (read-only) the current user's email address.

    Thanks for the tip about the last user to set the Job Queue status to Ready. I'll experiment with that.

    As far as I understand, from v20 onwards we've lost the ability to set the 'From Address' in AL Code (see link below):-

    How to change 'from address' when sending email in an AL Extension - Dynamics 365 Business Central Forum Community Forum

    so it won't be in the codeunit.

    That's why I'm experimenting with 'Current User' Email Account.

  • Suggested answer
    MahGah Profile Picture
    15,529 on at
    RE: Current User Email Account

    Hi Nick

    Alternatively, you can create SMTP user then make it default. We use the same method in our BC. This way we are sure all emails without scenario are going out from one email. This way we can monitor them,

  • Nick Webb Profile Picture
    891 on at
    RE: Current User Email Account

    Hi MahGah,

    We have two modes of email sending: (1) Manually, when users are logged in to BC. For this we would like the emails to be sent from the current user's email address. & (2) Auto (from Codeunits/Job Queues). For this we would like to be able to specify the sender address.

    In the past we've always used SMTP, but, as I said previously, I'm trying new things because of the newly introduced limitation I've been highlighting. For the Auto mode, we would want to send from an email address that has nothing to do with any user in BC (e.g. donotreply@domain.com or accounts@domain.com).

    By the way I have verified your theory about who was last to set a job queue to ready. You are correct, but I'm not sure it helps me.

    Thanks

  • Suggested answer
    MahGah Profile Picture
    15,529 on at
    RE: Current User Email Account

    I think new method requires a little more setup to work. This is what I did (used following article). But this may not work for you.

    In Email Account under Navigate -> Email Scenario I selected all possible scenarios to Current User. This way when our user trigger email manually for those scenarios (such as SO) it uses their email. Then I set the SMTP email (something like noreply)  as a default. Now, all Job Queue email goes under SMTP email and manual trigger under user

    robertostefanettinavblog.com/.../

  • Nick Webb Profile Picture
    891 on at
    RE: Current User Email Account

    Thanks for your help MahGah. I've setup as per your description above and it seems to be providing the functionality we require. However, I'm left with the feeling that something that was very simple (one line of code), has now become inordinately complicated. I also have a sense that a future requirement is going to force a re-think on this email account setup, whereas that wouldn't be the case if this line of code still worked: obj."From Email" := someone@somewhere.com

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans