Skip to main content
Microsoft Dynamics AX forum
Unanswered

Send Emails to multiple recipients with SysEmailSystemTable by X++

editSubscribe (0) ShareShare
ReportReport
Posted on by 508

This Post is in duplicated sorry. Here the right one

Hi all,

I am kinda new with batch processing and emails, so I would like you guys to give me a hand with this.

I have a code that calculates the prices of production against the sales orders. If the Productions costs > Sales order then pulls a trigger by code and send Email to specifics recipients.

I have configurated the basics stuff like email parameters and templates. And my code is actually sending the emails into the waiting stack ( ) . but only sends the actual email only if I pressed the ok button in the batch job. where Do I configure it in order to send emails directly after the trigger is pulled (just at the moment the code sends the email).

also How Do I sent to multiple recipients using the SysEmailSystemTable::sendMail()

here the code

static void AKS_NC_PreCalculate_Emails(Args _args)
{
    SysEmailTable   sysEmailTable;
    SysEmailSystemTable sysEmailSysTable;
    Map             mappings        = new Map(Types::String, Types::String);
    List            recipients;
    // str             xml;
    ;

    // Build your variable/text mappings
    mappings.insert('show_info', 'Here the Info body on the Mail ');

    //sysEmailSysTable = sysEmailSysTable::find('ProdCost');
    sysEmailSysTable =SysEmailSystemTable::find('ProdCost');

    
    SysEmailSystemTable::sendMail(sysEmailSysTable.EmailId,
                            'en-gb', // Chosen language
                            "", // Who you're sending the email to
                            mappings, // Your variable mappings
                            '', // Location of file attachment (server/client matters) or none
                            '' , // XML if you're using XSLT
                            true, // Traceable or not?
                            'Nestor', // Sending user
                            true); // Use retries?

    info("email Sent");

}

  • Abdulaziz Albloshi Profile Picture
    Abdulaziz Albloshi 365 on at
    RE: Send Emails to multiple recipients with SysEmailSystemTable by X++ AX2012

    you have to set recurrence on the batch job so it run periodically. also Email sending has its own batch job so check the recurrence of that batch job too.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,066 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,585 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans