SENDMAIL – Send an email via z/OS SMTP
Use SENDMAIL
to send a simple email
to a single named recipient. The command relies upon SMTP having already
been set up within the z/OS system on which the job runs. Workload Automation Programming Language requires
that an email has both a subject and text.
SENDMAIL [FROM(<address>)] [SERVER(<server>)] SUBJECT(<text>)
[TEXTDD(<ddname>)] TO(<addresses>) [CC(<addresses>)]
[BCC(<addresses>)]
[TXT(line of text)]
[TXT(line of text)]
Note: To enable Workload Automation Programming Language to
send emails, the EQQSMTP DD statement must be added either to the Workload Automation Programming Language procedure
being used, or the executing JCL of the step. The DD statement needs
to contain a SYSOUT class pointing to the correct class and writer
for SMTP email via z/OS. The name of the SMTP DD statement can be
set by
OPTIONS MAILSMTP
.The following keywords are available:
FROM
- Allows the email sender's address to be specified. If no domain
is specified the
SERVER
domain is appended to the address. IfFROM
is not specified theOPTIONS
value forMAILFROM
will be used. If noFROM
address is provided either by theFROM
keyword orOPTIONS
MAILFROM
the command will fail. SERVER
- Provides the domain name to be used as part of the HELLO handshake
with the mail server. If the
SERVER
keyword is not specified theOPTIONS
value forMAILSERV
will be used. If noSERVER
is provided either by theSERVER
keyword orOPTIONS MAILSERV
the command will fail. SUBJECT
- Specifies the subject line of the email.
TEXTDD
- Refers to a DD statement in the JCL from which the text of the
email will be read. The DD statement must refer to either a sequential
file or an individual member within a partitioned dataset or library.
The value of the
TEXTDD
keyword will default toEQQEMAIL
if not specified. The default value can be altered byOPTIONS MAILDD
. TO
- Specifies the primary recipients of the email. If no domain is
specified the
SERVER
domain is appended to the address. CC
- Specifies the copy list of recipients.
BCC
- Specifies the blind copy list of recipients.
TXT
- Specifies an individual line of text for the email. Multiple
TXT
keywords can be coded.
The following example shows a
SENDMAIL
command:OPTIONS MAILSERVER(frog1.frogpond.abc.com)
VARSUB SCAN(!)
SENDMAIL FROM(dean) TO(warren@nj.com) SUBJECT(Test SENDMAIL)
CC(doug@pa.com,ann@pa.com) BCC(dean) :IFCMD(LISTSTAT.EQ.4)
TXT(Here is the text in the main command stream)
TXT(you can have as many TXT statements as you like)
TXT(and they can have variables like JOBNAME=!OJOBNAME.)