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
SERVERdomain is appended to the address. IfFROMis not specified theOPTIONSvalue forMAILFROMwill be used. If noFROMaddress is provided either by theFROMkeyword orOPTIONSMAILFROMthe command will fail. SERVER- Provides the domain name to be used as part of the HELLO handshake
with the mail server. If the
SERVERkeyword is not specified theOPTIONSvalue forMAILSERVwill be used. If noSERVERis provided either by theSERVERkeyword orOPTIONS MAILSERVthe 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
TEXTDDkeyword will default toEQQEMAILif not specified. The default value can be altered byOPTIONS MAILDD. TO- Specifies the primary recipients of the email. If no domain is
specified the
SERVERdomain 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
TXTkeywords 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.)