This blog explains the new replaced objects provided by Microsoft for SMTP and showcases its working to send emails using the new replaced objects.
We have widely used SMTP Mail setup and SMTP Mail to send email notification in NAV and early versions of Business central but as SMTP Mail setup(Record 409) and SMTP Mail (codeunit 400) has been marked for removal and will be deprecated soon, Microsoft has provided a replacement for these objects.
Email Message – replaces SMTP Mail
Email Accounts – replaces SMTP Mail setup
Pre-requisites:
Business central
Visual studio code
Steps:
Firstly, we need to set up an email account i.e the sender’s email account in business central. Navigate to the search bar and type email account.
Click on New and select add an email account.
Add an email account
3. It will pop up with three options as above
Microsoft 365 – You can configure a Microsoft 365 shared mailbox as a sender’s email to send emails.
Current user – You can send emails using the user’s login email credentials
SMTP – You can send emails using SMTP server connector.
4. If you choose SMTP, click on apply office 365 server settings and add the mandatory fields
5. In my blog, I’m triggering an email whenever there is change in purchase direct cost.
Here, using Record Email Account to create an SMTP Connector
Body message is a text variable to story the email text along with html tags
Codeunit Email Message is used to create an email message with list of recipients,subject, body and htmlformatted. As I’ll be using html tags, I’ve marked them as true.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are as essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.