Today i am going to show you code how to send an auto-email through x++ code when the purchase order posting a product receipt class DAL_PurchFormLetterClass_EventHandler { /// <summary> /// /// </summary> /// <param name="args"></param> [ PostHandlerFor ( classStr ( PurchFormLetter ), methodStr ( PurchFormLetter , run))] public static void PurchFormLetter_Post_run( XppPrePostArgs args) { PurchFormLetter PurchFormLetter = args.getThis() as PurchFormLetter ; VendPackingSlipJour vendPackingSlipJour; PurchTable PurchTable = PurchFormLetter.purchTable(); if (PurchFormLetter.documentStatus() == DocumentStatus ::PackingSlip && !PurchFormLetter.proforma()) { vendPackingSlipJour = PurchFormLetter.parmJournalRecord(); this. sendMail_ProductReceipt(vendPackingSlipJour); }