Sending emails/notification from D365 FO X++

Sending emails/notification from D365 FO X++

Suppose there is a scenario where you need to notify someone via email then this approach can be useful to get the appropriate result.

For sending an email we need to configure the environment.

Go to System Administrator> Setup> Email> Email parameters

No alt text provided for this image

Fill the form accordingly.

Put your username and password on the respective fields.

While server name and port # are subjective to the SMTP setting of the email. (you can check yours via Email Settings> SMTP Settings)

No alt text provided for this image

Now it’s time to trigger the logic so basically, I am creating a runnable class, you can put your logic accordingly.


class RunnableClas

{

????
????public static void main(Args? _args)

????{

???????

???????SysEmailParameters _SysEmailParameters;
?????? ?
       var builder = new SysMailerMessageBuilder();
?
?????? select SMTPUserName from _SysEmailParameters;
????????
       builder.setFrom(_SysEmailParameters.SMTPUserName);

???????builder.addTo("[email protected]");

???????builder.addTo("[email protected] ");

???????builder.setSubject("For D365 Learning Purpose");

???????builder.setBody("Hello this is Saim Siddiqui");

???????var message = builder.getMessage();

???????SysMailerFactory::getNonInteractiveMailer().sendNonInteractive(message);

???????Info("Email Sent Successfully");

??????

????}

?

}        

要查看或添加评论,请登录

Saim Siddiqui的更多文章

  • Add Lookup to Batch Job Dialog

    Add Lookup to Batch Job Dialog

    For creating batch job parameters create a contract class that contains a reference to the UI builder. […

  • Setup Postman To Call D365 FO Data Entities

    Setup Postman To Call D365 FO Data Entities

    Assuming you are composing a reconciliation into D365 you probably will need to arrange for Postman to call D365…

  • Create Custom Services x++

    Create Custom Services x++

    In this article, we will create Rest and Soap for both the services for SalesOrder. For Service creation, we need the…

    5 条评论
  • D365 FO- Upload utility using x++

    D365 FO- Upload utility using x++

    This topic will provide information about file upload and template generation by using x++. For template and file…

  • Register Number Sequence on EDT

    Register Number Sequence on EDT

    You have seen, when you create a Customer/Sales Order the AccountNum/SalesId has a number sequence on the enum of the…

  • D365 FO- Jump reference x++

    D365 FO- Jump reference x++

    If you want to jump from FormControl, to another Form you can use the jumpRef approach. Scenario: There is a custom…

    3 条评论
  • D365 Finance and Operations-COC

    D365 Finance and Operations-COC

    There are many numbers of objects that exist on D365 FO that can use a chain of command (COC). So, I am listing some of…

    4 条评论

社区洞察

其他会员也浏览了