Setting additional Mime header properties on email using SMTPMailService

Date:2 February 2012
Product/Release:LANSA Integrator - All versions
Abstract:How to add additional MIME header properties to email being sent via SMTPMailService
Submitted By:LANSA Technical Support

You may want to add additional MIME header properties as well as the keywords already provided by the SMTPMailService. For instance, values header properties such as Reply-to, Disposition-Notification-To, Return-Receipt-To, Reply-By cannot be specified as keywords by the SMTPMailService.

You can however, still set these by using the SET Command with the HEADER Keyword which receives a list of HEADER properties and their values.

A sample snippet code is shown below.

* *********
* ********* 'Add header'
* ********* 
CHANGE FIELD(#HDNME) TO('''Importance''')
CHANGE FIELD(#HDVAL) TO('''high''')
ADD_ENTRY TO_LIST(#HEADER)
CHANGE FIELD(#HDNME) TO('''X-Priority''')
CHANGE FIELD(#HDVAL) TO('''1''')
ADD_ENTRY TO_LIST(#HEADER)
CHANGE FIELD(#HDNME) TO('''X-Message-Flag''')
CHANGE FIELD(#HDVAL) TO('''Read''')
ADD_ENTRY TO_LIST(#HEADER)
CHANGE FIELD(#HDNME) TO('''X-Message''')
CHANGE FIELD(#HDVAL) TO('''Some message''')
ADD_ENTRY TO_LIST(#HEADER)
CHANGE FIELD(#HDNME) TO('''Reply-By''')
CHANGE FIELD(#HDVAL) TO('''Tue, 24 Jul 2000 19:02:00 +1000''')

ADD_ENTRY TO_LIST(#HEADER)
CHANGE FIELD(#HDNME) TO('''Return-Receipt-To''')
CHANGE FIELD(#HDVAL) TO('''aaaaaa aaaaaa<aaa.aaa@lansa.com.au>''')
ADD_ENTRY TO_LIST(#HEADER) 
CHANGE FIELD(#HDNME) TO('''Disposition-Notification-To''') 
CHANGE FIELD(#HDVAL) TO('''bbbb Bbbbbb <bbbbb.bbbb@lansa.com.au>''')
ADD_ENTRY TO_LIST(#HEADER) 
CHANGE FIELD(#HDNME) TO('''Reply-To''') 
CHANGE FIELD(#HDVAL) TO('''ccccc cccccc 
<cccccccc.ccccc@lansa.com.au>''') 
ADD_ENTRY TO_LIST(#HEADER)
* *********
CHANGE FIELD(#JSMCMD) TO('SET HEADER(*LIST) SERVICE_LIST(HDNME,HDVAL)')

USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG 
#HEADER) EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
* *********
* *********