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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Email Sending via Business Central Web Service Not Working

(1) ShareShare
ReportReport
Posted on by 7
Hello Community
 
I have created a codeunit procedure for sending emails to specific customers in Business Central. The procedure works successfully when called from a page, but fails when invoked through Business Central Web Services.
 
Technical Details:
- The procedure is marked with [ServiceEnabled] attribute
- Works when called from BC page
- Does not work when called via web service
 
Expected Behavior:
Email should be sent when the procedure is called via web service, just as it works when called from the page.

 

Question:
What could be causing this difference in behavior between page calls and web service calls? How can I resolve this issue?

 
I have the same question (0)
  • Suggested answer
    Dr Gomathi MVP, MCT Community lead, MLE Profile Picture
    395 Super User 2025 Season 2 on at
    The issue where your email sending procedure works from a Business Central page but fails when called via a web service is likely due to different execution contexts and permissions.
     
    • Ensure the user calling the web service has email sending permissions.
    • Assign the user SUPER permissions or explicitly provide the Email and SMTP permissions in Permission Sets.
    • Try running the function inside a SessionSettings object with EnableSession(true).
    • Alternatively, use Job Queue to schedule the email process.
    • Log email errors in Event Viewer or Business Central logs.
    • Add proper error handling to capture if Email.Send(SMTPMail) fails.
    • Ensure the codeunit containing this function is exposed as a web service under Web Services in Business Central.
    Better to try the below possibilities
    • Check User Permissions: Ensure the calling web service user has email sending permissions.
    • Test Email Functionality in Web Service Context: Log errors when called from a web service.
    • Ensure SMTP is Accessible from Web Services: Run a test email send within a background session.
    • Expose Codeunit Correctly: Ensure it’s set as [ServiceEnabled] and registered in Web Services Page.
     
    Regards,
    Dr. Gomathi S
  • Suggested answer
    Gerardo Rentería García Profile Picture
    25,388 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Business Central Email Controller 🎮 – Josh Anglesea

    Best Regards
    Gerardo

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 2,132

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 675 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 665 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans