How to send email with 1 email account ? (not SMTP)

julkifli33
Member Posts: 1,092
Hi all,
I have customized something that send notification to vendor using SMTP account.
so no matter who click send email, it will be sent using SMTP email account.
(let's say : admin@abc.com)
understood that SMTP is no longer can be used in BC 20,
so we should use email account.
but how do we set only this email account to send ?
i want all the documents to be sent by admin@abc.com instead of personal email.
Thanks.
I have customized something that send notification to vendor using SMTP account.
so no matter who click send email, it will be sent using SMTP email account.
(let's say : admin@abc.com)
understood that SMTP is no longer can be used in BC 20,
so we should use email account.
but how do we set only this email account to send ?
i want all the documents to be sent by admin@abc.com instead of personal email.
Thanks.
0
Best Answers
-
That table to the Email - smtp extension.
So if you install Thst extension, found on appsource. You can use smtp emailing.
See also
https://docs.microsoft.com/en-us/dynamics365/business-central/admin-how-setup-email#legacy-smtp-settings-and-the-email---smtp-connector-extension0 -
You can use the function AddRecipient(RecipientType: Enum "Email Recipient Type"; Recipient: Text)
And recipientType you can choose to, cc or bcc because it is an enum.0 -
Hello @julkifli33,
You can use EmailMessage.Create with this signature and pass the CC or BC that you want/// <summary> /// Creates the email with recipients, subject, and body. /// </summary> /// <param name="ToRecipients">The recipient(s) of the email. A list of email addresses the email will be send directly to.</param> /// <param name="Subject">The subject of the email.</param> /// <param name="Body">The body of the email.</param> /// <param name="HtmlFormatted">Whether the body is HTML formatted.</param> /// <param name="CCRecipients">The CC recipient(s) of the email. A list of email addresses that will be listed as CC.</param> /// <param name="BCCRecipients">TThe BCC recipient(s) of the email. A list of email addresses that will be listed as BCC.</param> procedure Create(ToRecipients: List of [Text]; Subject: Text; Body: Text; HtmlFormatted: Boolean; CCRecipients: List of [Text]; BCCRecipients: List of [Text]) begin EmailMessageImpl.Create(ToRecipients, Subject, Body, HtmlFormatted, CCRecipients, BCCRecipients); end;
Regards0
Answers
-
You can still use SMTP in BC20 with the new email feature.
But you can also put a shared mailbox or setup a user account mail and attach that to the scenario.0 -
hi @BertVerb ,
I just received this notification :
"Error AL0433: Table 'SMTP Mail Setup' is removed. Reason: Moved to "Email - SMTP" app. Use SMTP connector to create SMTP accounts. Email accounts can be configured from "Email Accouts" page from "System Application".. Tag: 20.0."
isnt we cant use SMTP Mail Setup anymore?0 -
That table to the Email - smtp extension.
So if you install Thst extension, found on appsource. You can use smtp emailing.
See also
https://docs.microsoft.com/en-us/dynamics365/business-central/admin-how-setup-email#legacy-smtp-settings-and-the-email---smtp-connector-extension0 -
hi @BertVerb
thanks for your url link
i managed to send using new email connector
but do you have any idea how to add cc and bcc?
Old codeSMTPMail.CreateMessage(CompanyInformation.Name, SMTPMailSetup."User ID", ToAddress, EmailSubject, BodyTextEmail); SMTPMail.AddCC(CCEmail); SMTPMail.AddBCC(BCCEmail); SMTPMail.Send;
New CodeEmailMessage.Create(ToAddress, EmailSubject, BodyTextEmail, true); Email.Send(EmailMessage, Enum::"Email Scenario"::Default);
i tested but i cant find how to add cc and bcc
0 -
You can use the function AddRecipient(RecipientType: Enum "Email Recipient Type"; Recipient: Text)
And recipientType you can choose to, cc or bcc because it is an enum.0 -
0
-
hi @BertVerb ,
but seems doesnt sent to cc email
here is my codeEmailMessage.Create(ToAddress, EmailSubject, BodyTextEmail, true); EmailMessage.GetRecipients(RecipientType::Cc, CCEmail); Email.Send(EmailMessage, Enum::"Email Scenario"::Default);
0 -
@julkifli33 you use GetRecipients.
You must use AddRecipient0 -
0
-
Which version of BC are you at?
I can see in BC20 you have Addreciepient in codeunit codeunit 8904 "Email Message":
https://github.com/microsoft/ALAppExtensions/blob/main/Modules/System/Email/src/Message/EmailMessage.Codeunit.al0 -
Hello @julkifli33,
You can use EmailMessage.Create with this signature and pass the CC or BC that you want/// <summary> /// Creates the email with recipients, subject, and body. /// </summary> /// <param name="ToRecipients">The recipient(s) of the email. A list of email addresses the email will be send directly to.</param> /// <param name="Subject">The subject of the email.</param> /// <param name="Body">The body of the email.</param> /// <param name="HtmlFormatted">Whether the body is HTML formatted.</param> /// <param name="CCRecipients">The CC recipient(s) of the email. A list of email addresses that will be listed as CC.</param> /// <param name="BCCRecipients">TThe BCC recipient(s) of the email. A list of email addresses that will be listed as BCC.</param> procedure Create(ToRecipients: List of [Text]; Subject: Text; Body: Text; HtmlFormatted: Boolean; CCRecipients: List of [Text]; BCCRecipients: List of [Text]) begin EmailMessageImpl.Create(ToRecipients, Subject, Body, HtmlFormatted, CCRecipients, BCCRecipients); end;
Regards0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions