Kourier Integrator Online Help
You can create and send your own emails and include dynamic message content using Kourier.
The following example formats a message and passes in a database record and program data. To run this program, create message template MSO-Z001 with the message:
Your customer, {NAME}, has a new telephone number due to a restructuring of area codes in their region. Their new phone number is {PHONE}. Be aware than many of your contacts in area code ({%1}) are subject to change by {%2}.
The following program code formats the message template with information from the cust email:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22.  | 
                    * Open The Data And Dictionary Files Of The CUSTOMER File
CALL HW.OPEN('DICT CUSTOMER',FD.CUST,OFLAG,1)
CALL HW.OPEN('CUSTOMER',F.CUST,OFLAG,1)
*
* Find A Customer That Has A New Area Code
STMT = 'SSELECT CUSTOMER WITH PHONE = "[858/]" "[935/]" '
CALL HW.EXECUTE1(STMT, 'CRS', OUT, ERR, SELIST, SELCNT)
READNEXT ID FROM SELIST ELSE STOP
*
* Get The Database Record And Program Data
READ CUST FROM F.CUST, ID ELSE STOP
PARMS = 619 : @VM : 'December 31, 1999'
*
* Use The Default Width
WIDTH = ''  
* Format The Message With The Specified Template 
ETID = 'MSO-Z01'  ;* Email Template ID
CALL KMK.FMTMAIL(FD.CUST,ID,CUST,PARMS,WIDTH,ETID,MSG,ERRNO,ERRMSG)
IF ERRNO THEN
  PRINT ERRMSG
  STOP
END
                     |