Integrator SMTPMailService Rich Emails

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Integrator SMTPMailService Rich Emails

Post by jyoung »

I'm starting to do some research on how to send a rich html based email from Integrator.
The emails I have sent before have been simple text / one liners with attachments.

This email will be rich with different text formats, "call to action" indicators and dynamic data/content.

I am trying to figure out the best way to do this. From here https://www.lansa.com/support/tips/t0320.htm I could put all the html in a working list and go that route.

This doc http://docs.lansa.com/14/en/lansa093/in ... 7_2225.htm states that I could use a file and the example uses a "emailtext.txt" file.

A couple questions immediately come up:
  1. Where should this file reside on the server?
  2. Is this file a template, meaning it supports variable substitution, or is it just a static content file? If its just static content, that likely eliminates this option.
Thanks,
Joe
alick
Posts: 16
Joined: Fri Sep 02, 2016 2:43 pm

Re: Integrator SMTPMailService Rich Emails

Post by alick »

Hi,

1. Using file approach, the file must reside on the same server as the JSM server, the file content is static.

You can use an absolute path to any location on the server, or a path relative to the JSM instance path.

SET CONTENT(*HMTL) BODY(/folder/file.html) ENCODING(UTF-8)

or

SEND CONTENT(*HMTL) BODY(/folder/file.html) ENCODING(UTF-8)


2. Using working list, create the working list in the LANSA function.

SET CONTENT(*HMTL) #WRKLST

or

SEND CONTENT(*HMTL) #WRKLST

#WRKLST can be a single column/field, each list entry is a line.

#WRKLST can have 2 column/fields, each list entry is a line, the second column is the newline control.

DEFINE FIELD(#TXT) TYPE(*CHAR) LENGTH(80)
DEFINE FIELD(#CNTL) TYPE(*CHAR) LENGTH(2)
DEF_LIST NAME(#MESSAGE) FIELDS((#TXT) (#CNTL)) TYPE(*WORKING)

CHANGE FIELD(#CNTL) TO(*BLANK)
CHANGE FIELD(#TXT) TO('''<B>This is the third line of text</B>''')
ADD_ENTRY TO_LIST(#MESSAGE)
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: Integrator SMTPMailService Rich Emails

Post by BrendanB »

Joe,

you can use a file as a template by doing:

Code: Select all

Define Field(#EmailText) Type(*CHAR) Length(1000) Input_Atr(LC)

Def_List Name(#EmailBody) Fields(#EmailText) Type(*WORKING) Entrys(*MAX)

Use Builtin(TRANSFORM_FILE) With_Args(#EmailBody #TemplateName T) To_Get(#FILE_RETC)
#TemplateName is the name of the file (full path to the file).

if you have setup something you can scan for, then you can do substitutions. (eg:

Code: Select all

Selectlist Named( #EmailBody)

#EmailText.ReplaceAll('%Name%' #FullName)

Endselect
and then use something like:

Code: Select all

#jsmxcmd := 'SEND SUBJECT(' + #Subject + ') CONTENT(*HTML)'
Use Builtin(JSMX_COMMAND) With_Args(#currentJSMhandle #jsmxcmd) To_Get(#jsmxsts #jsmxmsg #EmailBody)
when you send.
Post Reply