Thursday, 24 December 2015

Sending Mail through X++

Here i building a html table string of all customers belonging to a customer group and sending it through smtp server. The mail client interprets the html of the message and display the customers in a table of records.

You can build the html table by merging with the records of your table and send the mail.

   CustTable custTable;
   System.Text.StringBuilder htmlTable;
   SysMailer mailer;

  htmlTable = new System.Text.StringBuilder();
  htmlTable.Append(@”<caption> Blue Company Customers”);
  htmlTable.Append(@”  </caption> </br>”);
  htmlTable.Append(“<TABLE BORDER=1>”);

  while select custTable where custtable.CustGroup == ‘AP’
     htmlTable.Append(“<TR ALIGN=’CENTER’>”);

   mailer = new SysMailer();

   //building mail details

   mailer.subject(“Automated Mail – Customers”);

   // Setting SMTP details


   // Sending Mail


No comments:

Post a Comment