OS/390 installations that run the SMTP started task can send Email messages from within the product rules language to one or more recipients. The SMTP started task acts as a gateway to the email servers on the internet. For example, the Microsoft Exchange servers are used for Email. When the product rules language sends a message to the SMTP started task with the destination address , the SMTP service forwards the message to an Exchange server. This facility allows important storage management events to be broadcast to operations and support personnel.
Also, since many modern alphanumeric pagers support Email messaging, storage management personnel with Email-enabled pagers can immediately receive information about critical events.
Starting SMTP
If your OS/390 installation already has
TCP/IP running, but has not started the
SMTP started task, the activation procedure is
relatively easy. To activate the SMTP region, only a
single change was required to the SMTP configuration
file: the BADSPOOLFILEID statement was changed to
specify the user ID where SMTP transfers unreadable
spool files and looping mail. The SMTP configuration
file is allocated to the CONFIG DD statement in
SYS1.PROCLIB(SMTP). While examining the
configuration file, also make note of the LOCALCLASS
parameter which defaults to SYSOUT class B.
After SMTP is started, the started task polls JES at
a specified time interval (30 second default) for freed SYSOUT files using
the external writer name of SMTP.
For more information about configuring and using the SMTP started task,
examine IBM manuals OS/390 eNetwork Communications Server IP Configuration
(SC31-8513) and IP User's Guide (GC31-8514).
Examine the TCP/IP Configuration File
The HOSTNAME from the TCP/IP client configuration file is required by the
rules procedure to send Email through SMTP. Examine the
SMTP and TCPIP members to make sure both have the
same data set allocated to the SYSTCPD DD statement.
The TCP/IP client configuration information is the data set allocated to the
SYSTCPD file.
Browse the configuration for the HOSTNAME and NSINTERADDR
statements. In most cases the HOSTNAME will be the SYSID. The
NSINTERADDR parameters define the DNS servers that are used to perform
the IP look-up given the domain names specified on email. Make sure the parameter is coded,
or DNS resolution will probably fail.
Add the SMTP DD statement to the DIF started task
The SMTP DD statement below must be added to the DIF started task, and
the task restarted. The SYSOUT class assignment should match the
LOCALCLASS parameter in the SMTP configuration file
(see Starting SMTP above). Also, the name of the SMTP started
task is specified. The parameters below are the OS/390 distribution defaults.
//SMTP DD SYSOUT=(B,SMTP),FREE=CLOSE
SYSOUT class matches LOCALCLASS in the SMTP
configuration; mismatch can prevent message delivery.Modify the Rules
The product rules can now be modified to produce email messages. Use the
DEFMSG statements to build and forward a message to the
SMTP DD statement. The SMTP commands are embedded
in the messages and are under your control. The sample below is probably sufficient to
produce email—simply change the recipient commands (RCPT) to valid email
address(es). Also, change the HELO command to use the
HOSTNAME mentioned in the TCP/IP configuration file above.
DEFRULE RULE1
IF &JOBNAME = TOME &DDNAME = TSTEMAIL
THEN ISSUE WRITEMSG(E1,E2,E3,E4,E5,E6,
E7,E8,E9)
DEFMSG $DEFAULT "" DD(SMTP ONLY NOHEADER)
DEFMSG E1 "HELO P390"
DEFMSG E2 "MAIL FROM:<RULES@DTSSOFTWARE.COM>"
DEFMSG E3 "RCPT TO:<STORMGR1@DTSSOFTWARE.COM>"
DEFMSG E4 "RCPT TO:<STORMGR2@DTSSOFTWARE.COM>"
DEFMSG E5 "DATA"
DEFMSG E6 "Subject: Test"
DEFMSG E7 "This is a test message from &jobname."
DEFMSG E8 "."
DEFMSG E9 "$$$CLOSE"
DEFMSG $DEFAULT "" DD(* NOONLY)
DEFMSG $DEFAULT statements are
used as compiler directives to change the DEFMSG parameter defaults for
the email messages, then return to the typical defaults. If any of the message defaults
have already been changed within the rules, they must be reset in the first DEFMSG
$DEFAULT statement.With one exception, the rest of the messages are SMTP commands and email
data that conform to the SMTP protocol. Since DEFMSG
processing performs symbolic substitution, any information available to the rules language
can be placed in messages. The sample has two email recipients — add or remove
RCPT commands as needed.
$$$CLOSE message forces DIF to close the SMTP file
allocated to DIF. The SMTP DD is then freed by DIF, which triggers the
SMTP started task to process the email message. DIF then reallocates
the SMTP DD for the next email message. Email message processing is
serialized to prevent message corruption.SMTP Commands
Reference material on the SMTP protocol and commands can be obtained
from many internet sites. Also, the IBM manual OS/390 eNetwork Communications
Server IP User's Guide (GC31-8514) has examples of sending email from a batch
job via IEBGENER.
Several internet sites for the SMTP protocol (RFC821) reference materials are listed below: