Sending mail in Dynamics AX without Outlook

In Dynamics one of our batch jobs should send out a mail to a speciffic user. This is the job I will use to do this.

static void SendMail(Args _args)
System.Net.Mail.MailMessage     mailMessage;
System.Net.Mail.SmtpClient      myMail;
System.Net.Mail.MailAddress     toMail;
System.Net.Mail.MailAddress     fromMail;
fromMail = new System.Net.Mail.MailAddress(““);
toMail = new System.Net.Mail.MailAddress(““);
mailMessage = new System.Net.Mail.MailMessage(fromMail,toMail);
mailMessage.set_Subject(“Enter the mail subject here”);
mailMessage.set_Body(“enter the mail body here”);
myMail = new System.Net.Mail.SmtpClient(“name of the smtp server”):

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>