web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Generating and Sending Emails in Dynamics AX

Community Member Profile Picture Community Member
To generate and send emails in dynamics AX we have SysMailer class. I've came accross a very good example and explanation from Brandon George blog. To give an example of how we used this, he added a new enum value to the Sales Status of a sales order called 'Credit Hold'. When a customer is past due, or is over there given credit limit, then the sales order is placed on 'Credit Hold' and a email is sent out to a given list of people (alias group of emails contained on the email server). The people that get this list decided when the sales order can be actually turned from Credit Hold, to Open Order. The automatically generated email is what keeps the flow of this information system controlled, and not being dependant on a user to have to send a email out.

Let's just dive right in and look at the SysMailer example code:


SysMailer mail;
;

mail = new SysMailer();
mail.SMTPRelayServers().add("mail.yoursmtpserver.com");
mail.fromAddress("test@test.com");
mail.tos().add("you@you.com");

// Build the Message
mail.htmlBody(strfmt(""));
mail.subject(strfmt(""));
mail.sendMail();


That's it! Pretty straight forward, and great piece of code that can be very useful when alerting, and sharing of information and events as they occur.

This was originally posted here.

Comments

*This post is locked for comments