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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

To, CC, BCC recipients while sending emails using X++

(1) ShareShare
ReportReport
Posted on by 23
Hi community,
 
I am working on a requirement where I need to send emails to people using To, CC and Bcc recipients.
 
One solution that I see is to use SMTP client to send using X++, but we are having some technical issues with our SMTP server.
 
Second, If I want the email distributor batch to send my email using the selected email provider (SMTP/Graph/Exchange), how can I specify the cc and Bcc emails while creating a record in the SysOutgoingEmailTable?
 
Third, If I want to send email using Graph, how to do it in X++, and will it allow me to specify the To, cc and Bcc emails?
 
Thanks in advance.
 
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    238,858 Most Valuable Professional on at
    You don't have to use the email distributor batch to use the other email providers. Look at How to send emails from code in AX 7, where I explained providers and showed code for constructing and sending a message. If you don't want to change your default provider, you can construct a specific one in code.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,799 Super User 2026 Season 1 on at
    Hi @Sohan,
     
    you can use SysMailerMessage et SysMailer classes.
     
    e.g.
    void sendEmail()
    {
      str senderEmail = "sender@example.com";
      str recipientEmail = "recipient@example.com";
      str subject = "Hello";
      str body = "This is the email body.";
    
      SysMailer mailer = SysMailer::construct();
      SysMailerMessage message;
    
      message.setFromAddress(senderEmail);
      message.addToAddress(recipientEmail);
      message.addCc("cc@exemple.com");
      message.addBcc("bcc@exemple.com");
      message.setSubject(subject);
      message.setBody(body);
      mailer.sendEmail(message);
    
    }
    Best regrads,
    Mohamed Amine MAHMOUDI
  • Martin Dráb Profile Picture
    238,858 Most Valuable Professional on at
    SysMailer class doesn't exist in D365FO.
     
    Instead, you can use classes like SysMailerSMTP or SysMailerExchange, but the recommended (extensible) approach is creating an instance through SysMailerFactory, as I demonstrated in the blog post.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 527 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 473

#3
Adis Profile Picture

Adis 284 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans