MVS E-Mail FAQ List
TBS Software Inc. is the author of SMTP-Send, a program for sending SMTP e-mail from IBM mainframes running MVS.
This FAQ is designed to answer common questions about sending e-mail from MVS.
What are my options for sending e-mail from MVS?
You can send e-mail from MVS (aka z/OS) including CICS by coding the datastreams yourself or by using a third-party product to do it for you. IBM provides a simple REXX exec, SMTPNOTE to send simple text messages. XMITIP is a REXX freeware exec that sends e-mails from Batch or TSO/ISPF. SMTP-Send sends e-mails from Batch, TSO/ISPF and CICS. For a comparison of SMTP-Send and XMITIP click here
What is SMTP? What is its purpose?
SMTP (Simple Mail Transfer Protocol) is a TCP/IP protocol used in sending and receiving mail. It is Internet's standard host to host mail transport protocol. It is defined by RFC821. Request For Comments (or RFC) documents are the written definitions of the protocols and policies of the Internet.
What is RFC822?
RFC822 is the standard for Internet Text messages. This standard specifies the syntax for text messages that are sent among computer users within the framework of "electonic mail" . RFC822 has been updated by various RFCs such as RFC1123, RFC1138, RFC1148, RFC1327, RFC2156
What is MIME and why is it important?
MIME is short for Multipurpose Internet Mail Extensions. MIME is defined and extended by many different RFCs. MIME allows the sending of binary and other complex messages such as HTML through the text based protocols of SMTP. Without MIME, the sending of attachments or in-line HTML would be impossible.
What does a SMTP data stream consist of?
The SMTP data stream consists of a series of RFC821 statements identifying the start of the SMTP conversation and the sender and recipients, followed by the message data. The message data usually includes a series of RFC822 message headers that describe the message to the receiving e-mail client. The actual message text follows the message headers.
A simple annotated example is below:
HELO command is used to identify the sender-SMTP to the receiver-SMTP. In the above, BAR.COM is the domain name of the sending SMTP user. The HELO command begins the SMTP conversation.
MAIL command tells the SMTP-receiver that a new mail transaction is starting. it gives the <reverse path> which
contains the source mailbox and can be used to report errors. The 1st host in the <reverse path> should be the host sending the MAIL command ,in this case is email@example.com.
RCPT is the 2nd step in the procedure. It identifies one recepient, specifying the destination mailbox. If accepted, the receiver-SMTP returns a 250 OK reply and stores the destination mailbox, in this case <firstname.lastname@example.org>, as the host receiving this command.
DATA command is the 3rd step in the SMTP procedure. If accepted, the receiver-SMTP returns a 354 intermediate reply and considers all succeeding lines to be message text. The mail data includes the memo header items such at DATE, Subject, TO, CC and From. The format of the memo headers is specified by RFC822. The following is all considered mail data;
Date: Fri, Jul 16 2019, 13:41:30 -0400
From: "Commissioner Gordon" <email@example.com>
Subject: DAILY REPORT OF DISK UTILIZATION
To: "Bruce Wayne" <firstname.lastname@example.org>
Please fix the bulb in the searchlight
The actual message data follows the RFC822 message headers, in this case following the 'blank' line after the To: "Bruce Wayne" <email@example.com> line.
A single period marks the end of the current message text. The receiver-SMTP will expect either another HELO command to begin a new conversion or QUIT to end the SMTP datastream
Ends the conversation and specifies the receiver must close the transmission channel
How can I send attachments?
SMTPNOTE can' t send attachments. Sending of attachments requires the data to be encoded so that the binary data can be transmitted across the network using the text-only SMTP protocols. The data itself must be encoded and MIME used to describe the attachment so that it can be recognised at the receiving end.
SMTP-Send can send attachments as can XMITIP.
To do it yourself, you need to encode the attachment (base 64 encoding is the most popular choice) and provide the necessary MIME headers to describe the attachment
How can I prevent users from pretending to be someone else when they send mail?
SMTPNOTE creates the from e-mail address using the TSO user's Userid. If a complete SMTP datastream was created by a batch job and sent to IBM's SMTP server, that piece of mail can claim to be from whoever it wants to.
Some companies have used JES2 exit 31 (SSI allocation) to restrict who can use the Writer name of SMTP, based upon the program name and SAF (RACF) userid.
SMTP-Send provides a verification exit that allows companies to verify or replace the sender's address based upon the SAF id, and Jobname and other criteria.
How does SMTP-Send insulate me from the various Internet Protocols?
SMTP-Send uses RFC821 and RFC822 protocols to send mail but uses an easily understood and programmed control statement interface for specifying the information required by the RFC821 and RFC822 protocols. When binary data is being transmitted, SMTP-Send automatically uses the appropriate MIME protocols to preserve the data fidelity and ensure that the data arrives at the receiving end correctly.
Where can I get more information about the IBM SMTP Server?
The SMTP Server is packaged as part of the z/OS Communications Server. An excellent redbook on the MVS TCP/IP tasks is IBM z/OS V2R1 Communications Server TCP/IP Implementation Volume 2: Standard Applications
See http://www.ibm.com/software/products/en/commserver-zos for information about Communications Server maintenance.
Do I have to use the IBM SMTP Server?
The SMTP Server is supplied as part of the z/OS Communications Server. It performs a number of functions such as receiving incoming SMTP traffic and reading outgoing SMTP traffic from the JES Spool and sending it to its ultimate destination. If you don't want to accept inbound SMTP traffic, see "How do I prevent spammers from hijacking my SMTP Server" below.
For outgoing traffic only, use SMTP-Send's Spool Server. This program, like IBM's SMTP Server reads outgoing SMTP items from the JES Spool. Unlike the IBM SMTP Server, it does not attempt to deliver each piece of mail to it recipients. Instead it sends the entire SMTP datastream to a remote SMTP mail server (known as a relay server). Many organizations employ such a server, sometimes called a smart host, to act a central point for outgoing mail.
My SMTP server doesn't recognize the @ character in my e-mail addresses. How can I send mail?
The @ character is defined as EBCDIC x'7C' in most but not all z/OS codepages. The SMTP Server uses the @ symbol to separate the local part from the domain in e-mail addresses and expects the @ symbol to be x'7C'.
A recent fix to CommServer, PQ36249, addresses this issue allowing a different character to be used as the @ symbol.
How can I get my SMTP Server to relay all mail to another SMTP mail server?
The SMTP server can be instructed to relay all outgoing mail for which it cannot locate the host to another SMTP server. If the SMTP server is configured to not resolve any addresses, then all recipients will be unknown and you can direct the mail to another server.
- Copy your TCP/IP profile data set (DDname SYSTCPD in the SMTP started task) to a new data set.
- In your SMTP CONFIG data (DDname CONFIG in the SMTP started task) specify a IPMAILERADDRESS statement. The syntax is IPMAILERADDRESS xx.xx.xx.xx where the xx.xx.xx.xx is the numeric IP address of the target SMTP mail server.
- Comment out the NSINTERADDR statements in the copied SYSTCPD data set. This will prevent the SMTP server from using Domain Name Services to resolve the location of any e-mail address. SMTP will now only use the site table to resolve e-mail addresses into target host IP addresses.
- Change your SMTP started task JCL to use the altered copy of the TCP/IP parameters and the updated CONFIG data set .Restart your SMTP server. Any mail for which the IP address of the target host cannot be determined will now be redirected to the SMTP server named in the IPMAILERADDRESS statement.
- Or you can use SMTP-Send's Spool Server and skip steps 1 through 4.
How do I prevent spammers from hijacking my IBM SMTP Server?
- Don't connect directly to the Internet. A firewall can be used to block any unwanted traffic. If you don't use your SMTP server to receive external e-mail, ask your firewall people to disable port 25 to inbound traffic. That way spammers can't send any inbound relay traffic.
- Relay all of your e-mail to another non-MVS SMTP server that can detect the unwanted relay traffic.
- If you send all of your e-mail throught the Spool/NJE interface you can set MAXMAILBYTES 1 which means you only accept 1 byte messages over TCP connections
- You can code the SMTPEXIT to inspect all traffic coming into your SMTP Server via TCP/IP. With the addtion of APAR PQ13476 you can also inspect data entering via the JES Spool. Refer to Communications Server IP Configuration Reference for additional information on SMTP Exits.
- Use SMTP-Send's Spool Server instead of IBM's SMTP Server to only accept SMTP traffic from the spool.
How can I tell who's sending e-mails?
Using IBM's SMTP Server to accept the mail, you can turn on Logging and view the LOGFILE to see the headers from the e-mail traffic.
Using SMTP-Send you can write records to SMF, CICS journals or a sequential dataset which contain details about each email such as which user sent it, to which users, with how many attachments, what was the subject, what is the size and more.