The ADD command is used to include one or more file attachments on the email being formatted.
Files can be added directly to the email, or the ZIP keyword can be used to create an archive file of a nominated list of files. The archive file is then included as a single attachment on the email.
The ADD keyword must be used before the SEND keyword.
ADD --------- ATTACHMENT ----- *LIST -------------------------->
>-- ZIP ------------ value --------------------------|
A single file can be attached to the email by nominating the file path and name in the ATTACHMENT keyword.
To include more than one file attachment, create a working list of files where the first field in the list is the file path and name. The optional second field in the working list is the attachment display name or the zip entry name. Use the *LIST value for the ATTACHMENT keyword and include the working list information as a service list.
If no file attachments are included the ADD command will be ignored.
The name to be given to the zip archive created and attached to the email. The file name should include the suffix .zip for easy processing when the email is received.
The ZIP keyword will be ignored unless a list of files is provided using *LIST in the ATTACHMENT keyword.
Include a single text file as an attachment to the email.
USE BUILTIN(JSM_COMMAND) WITH_ARGS('ADD ATTACHMENT(orderabc.txt)') TO_GET(#JSMSTS #JSMMSG)
Zip a group of files and attach the single zipped archive to the email.
define field(#file name) type(*char) length(255)
def_list name(#filelist) fields(#file name) type(*Working)
#file name := order.xml
#file name := history/lastorders.pdf
#jsmcmd := 'add attachment(*list) zip(orderstatus.zip)'
use builtin(jsmx_command) with_args(#jsmhandle #jsmcmd) to_get(#jsmsts #jsmmsg #filelist)