Skip to main content

Posts

Showing posts with the label mail

How to send email messages with attachments

Sending E-mail messages from Microsoft Dynamics AX could be a bit tricky. As I mentioned in a following blog post, the most recommended way to do so is by using the standard mail mechanism built in the system. The Email sending status form (based on table SysOutgoingEmailTable ) and the E-mail distributor batch job (read more about it here ). But if you want to send email with attachments and more advance options, you should do so with .NET Framework, and the System.Net.Mail object. First of all, make sure you have a correctly configured SMTP server. Go to Administration -> Setup -> E-mail parameters and fill the required settings: (Form: SysEmailParameters) Then, use this code sample: void SendMail() { System.Net.Mail.MailMessage mailMessage; System.Net.Mail.Attachment attachment; System.Net.Mail.AttachmentCollection attachementCollection; System.Net.Mail.SmtpClient smtpClient; System.Net.Mail.MailAddress ...

How to send email messages with Microsoft Dynamics AX

There are more than one way to send emails through Microsoft Dynamics AX system, using X++ code. The most recommended way is to use the standard mail mechanism built in the system. That way copies of any email you send will be save in the Email sending status form (based on table SysOutgoingEmailTable ) and you will be able to monitor and see status of sent emails: (Administration -> Periodic -> E-mail processing -> Email sending status; Form: SysOutgoingEmailTable) This mechanism based on a system table that contain the emails, and a batch job that scan that table and send the emails, one by one (with retries and status controlling). This technique is very simple to use and therefore it has some disadvantages; you cannot add attachments or use advanced email properties (cc, bcc, priority flag, etc). To use this mechanism, first you have to make sure you a SMTP server configured and running. Go to Administration -> Setup -> E-mail parameters and fill the required se...