SET
The SET command is used to prepare the email. In many ways the SET command is an extension to the SEND command. The SET command can be called many times, with one or more keywords to build up the email definition before it is sent. (This is especially useful in RDML where the command length is limited to 256 characters).
In addition the SET command allows a list of email recipients to be nominated as TO, CC or BCC parties. In contrast the SEND command can only nominate a single email address for these keywords.
At least one keyword must be provided to use the SET command. The SET keyword must be used before the SEND keyword.
Optional
SET --------- SERVER -------- host ---------------------------->
>-- SECURE -------- *NO ----------------------------->
*YES
*IMPLICIT
*EXPLICIT
>-- TO ------------ *LIST --------------------------->
value
>-- CC ------------ *LIST --------------------------->
value
>-- BCC ----------- *LIST --------------------------->
value
>-- FROM ---------- value --------------------------->
>-- FROM_NAME ----- value --------------------------->
>-- SUBJECT ------- value --------------------------->
>-- USER ---------- value --------------------------->
>-- PASSWORD ------ value --------------------------->
>-- PORT ---------- 25 ------------------------------>
value
>-- MAILDOMAIN ---- domain name --------------------->
>-- NTLMDOMAIN ---- domain name --------------------->
>-- CHARSET ------- UTF-8 --------------------------->
Value
>-- SIMPLIFY ------ *NO ----------------------------->
*YES
>-- HEADER ------- *NONE ---------------------------->
*LIST
>-- CONTENT ------ *NONE ---------------------------->
*PLAIN
*HTML
mimetype
>-- BODY --------- value ---------------------------->
>-- ENCODING ----- *DEFAULT -------------------------|
value
Keywords
SERVER |
Any server nominated will be used and overrides the server and port information derived from the service properties file. |
SECURE |
Connect to the server using SSL. Implicit connects to port 465 using SSL. Explicit connects to port 587 and upgrades to a TLS session. |
TO |
Include a single email address or the *LIST value to nominate any "to" addresses. The *LIST value is used if the email is required to be sent to more than one email address. The list of email addresses is passed using the service list. The first field is the address and the optional second field is the display name. Alternatively, a single email address can be specified using the TO keyword in the SEND command. At least one TO email address must be supplied to SEND an email. |
CC |
Include a single email address or the *LIST value to nominate any "copy to" addresses. The *LIST value is used if more than one CC email address is required. The list of email addresses is passed using the service list. The first field is the address and the optional second field is the display name. Alternatively, a single email address can be specified using the CC keyword in the SEND command. |
BCC |
Include a single email address or the *LIST value to nominate any "blind copy to" addresses. The *LIST value is used if more than one BCC email address is required. The list of email addresses is passed using the service list. The first field is the address and the optional second field is the display name. Alternatively, a single email address can be specified using the BCC keyword in the SEND command. |
FROM |
The email address this message originated from. The FROM property is typically configured in the SMTPMailService properties file as it usually does not change and this ensures a consistent FROM email address which can be easily changed in just one location if required. Alternatively this value may be specified in the SEND command. A FROM email address must be supplied to SEND an email. |
FROM_NAME |
Indicates a text name to be displayed as the "from" email display name. If a name is not supplied the FROM email address will be displayed. The FROM_NAME property is typically configured in the SMTPMailService properties file as it usually does not change and this ensures a consistent FROM_NAME to match the configured FROM email address. |
SUBJECT |
Indicates the subject of the email. The *LIST value is used to get the subject text a two column working list. The working list must have two columns and a list entry with the first field with a key value of SUBJECT and the second value field containing the single line of subject text. This mechanism was introduced to allow Unicode subject text, but is now obsolete as the JSM command BIF can now accept Unicode command field. Alternatively this value may be specified in the SEND command. |
USER |
This is the user profile used to login to the SMTP server. This user name may be case sensitive depending on the server. |
PASSWORD |
This is the password used to login to the SMTP server. The password may be case sensitive depending on the SMTP server and must match the USER keyword provided. |
PORT |
Nominate the TCP port to be used for SMTP. The default for SMTP, port 25, is used if an alternative port number is not supplied. If a port other than 25 is used the PORT property is typically configured in the SMTPMailService properties file rather than setting the PORT keyword each time an email is sent. |
MAILDOMAIN |
This is the mail domain issued by the SMTP HELO subcommand to identify the server initiating the mail transaction. The default value used is the localhost domain. The MAILDOMAIN property is typically configured in the SMTPMailService properties file. |
NTLMDOMAIN |
This is the NTLM domain for NTLM authentication. The NTLMDOMAIN property is typically configured in the SMTPMailService properties file. |
CHARSET |
The character set encoding to be applied to body text and the subject. The default value applied is iso-8859-1. The CHARSET property is typically configured in the SMTPMailService properties file. |
SIMPLIFY |
Simplify a multipart plain text message into a simple plain text message. |
HEADER |
This allows MIME header fields to be sent with the message. The *NONE value clears the all headers. The *LIST value is used supply a list of name values. The first field is the field and the second field is the value. |
CONTENT |
This allows up to three multipart/alternative text messages to be sent. The *NONE value clears all three text messages. The *PLAIN value creates the text/plain content. The *HTML value creates the text/html content. The MIME type value creates the custom content. ie. text/enriched. See SEND command on how to create the body text from the working list argument. |
BODY |
A file can be nominated to contain the body text. If the specified file does not exist the body text is created from the service list argument if it is provided. If the BODY keyword is used any reference to a working list is ignored as the body text is taken from the file and converted to Unicode using the ENCODING keyword value. |
ENCODING |
Used to specify what encoding must be applied to the byte content to convert it to a Unicode string. The default value for the ENCODING keyword is *DEFAULT. Refer to See ENCODING for more information. |
Comments / Warnings
Any keyword values set up using the SET command will be overridden by use of the equivalent keyword on the SEND command.
Examples
RDML
Sets who the email is from and addresses the email to a single email address.
USE BUILTIN(JSM_COMMAND) WITH_ARGS('SET FROM([email protected]) TO([email protected])') TO_GET(#JSMSTS #JSMMSG #TOLIST)
or
Sets the email to be sent to the group of email addresses included in the list #TOLIST. Issues a second SET command to indicate who the email is from.
USE BUILTIN(JSM_COMMAND) WITH_ARGS('SET TO(*LIST) SERVICE_LIST(ADDRESS)') TO_GET(#JSMSTS #JSMMSG #TOLIST)
USE BUILTIN(JSM_COMMAND) WITH_ARGS(SET FROM ([email protected])') TO_GET(#JSMSTS #JSMMSG #TOLIST)
RDMLX
Process a group of email addresses separated by a semicolon, into a working list and set this list of emails as to addressees on the email.
* Set the to address(es)
#start := 1
dountil (#pos = 0)
if (#ccaddress.cursize > #start)
#pos := #toaddress.positionof( ';', #start )
else
#pos := 0
endif
if (#pos = 0)
#jsmemail := #toaddress.substring( #start )
else
#jsmemail := #toaddress.substring( #start, (#pos - #start) )
#start := #pos + 1
endif
if (#jsmemail *ne *blank)
add_entry to_list(#tolist)
endif
enduntil
use builtin(jsmx_command) with_args(#jsmhandle 'set to(*list) ') to_get(#jsmsts #jsmmsg #tolist)
execute subroutine(check) with_parms(#jsmsts #jsmmsg)