Bojensen Blogs

Sending email via SMTP using X++ and .NET Framework in Dynamics AX

Configuration

Before email can be sent using SMTP, you’ll need to specify the SMTP server settings in the system administration module of AX.

Dynamics AX 2012: System administration > Setup > System > E-mail parameters
Dynamics AX 2009: Administration > Setup > E-mail parameters

The field values that must be specified in this form will depend on how the SMTP server is configured, but many times only the first two fields need to be set. Once you populate this form, you’ll want to send a test email.

Code sample

The following code may be copied into a new job in the AOT. Set the variables at the top according to your needs, and execute the job.

 

If you’re looking for additional email options, check out Wai Keat Ng’s

Posted on by

Comments are closed.