Enhancement in EPC721 to allow new Content Types also allows embedding Images in "text/html" Email Content

Date:Archived
Product/Release:LANSA for the Web V10
Abstract:Images can now be embedded in an email after applying EPC721 to LANSA for the Web V10
Submitted By:LANSA Technical Support

EPC721 has introduced an enhancement to the LANSA iSeries product. It allows Content-type to be set for emails sent by LANSA for iSeries.

The Built-In Function MAIL_SET_OPTION can now be used with Option name "CONTENT_TYPE" to set the format of the text of an email via the Option value.

The default CONTENT_TYPE for an email is "text/plain". A commonly requested CONTENT_TYPE is "text/html".

Using the newly introduced CONTENT_TYPE of "text/html", you can now insert/embed images in the body of your mail.

The only additional steps required to do this are

  1. Set content type to TEXT/HTML
USE BUILTIN(MAIL_SET_OPTION) WITH_ARGS(CONTENT_TYPE 'TEXT/HTML')
  1. Insert text in the body in HTML format that merges the image in.
CHANGE FIELD(#MYTEXT) TO('<font color="blue"><h1>this is a test message</h1><IMG src="MYIMAGE.JPG"></font>')
USE BUILTIN(MAIL_ADD_TEXT) WITH_ARGS(#MYTEXT Y) TO_GET(#RETCDE)
  1. Attach the image using the MAIL_ADD_ATTACHMENT BIF
CHANGE FIELD(#KEYFILE) TO('''MYIMAGE.JPG''')
USE BUILTIN(TCONCAT) WITH_ARGS('/QDLS/www/' #KEYFILE) TO_GET(#FULLFILE)
USE BUILTIN(MAIL_ADD_ATTACHMENT) WITH_ARGS(#FULLFILE #KEYFILE) TO_GET(#RETCODE)