MVS Mail page

MVS Mail

The purpose of this page is for information sharing about using IBM's implementation of SMTP


Getting started with SMTP

SMTP, Simple Mail Transfer Protocol, is a standard for sending e-mail over the Internet using TCP/IP. For more information, see RFC 821

IBM's TCP/IP for MVS comes with a very primitive line-mode TSO command called SMTPNOTE that allows you to send text-only notes from TSO to any connected Internet or Intranet mail host that supports SMTP. Once you've used the SMTPNOTE TSO command once, you'll want to use something more user-friendly. All the SMTPNOTE command does is put a note in SMTP note format on the JES2 SPOOL. Your TCP/IP SMTP task will pull this item off the spool and send it to the TCP/IP IP or host destination.

To demonstrate that they didn't put "Simple" in the name SMTP for nothing, here is an example of creating a SMTP note via a batch job using the IEBGENER utility:

//SENDNOTE EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=(B,SMTP) //SYSUT1 DD * helo MVSHOST mail from:<MVSUser@MVSHost.xyz.com> rcpt to:<unixuser@pop3.xyz.com> data From: MVSUser@MVSHost.xyz.com To: unixuser@pop3.xyz.com Subject: Test message from MVS using SMTP This is a line in the body of the note.


You will need to change:
  • "MVSHOST" (on the "helo MVSHOST" line) must match the JES Node name for your system as defined in your 'SYS1.PARMLIB(IEFSSNxx)' for the VMCF subsystem. If you are a JES2 site, look at any JES2 job log for the node name at the top after "N O D E".
  • "unixuser@pop3.xyz.com" to valid destination SMTP e-mail address
  • "MVSuser@MVSHost.xyz.com" to a valid TSO user and host

    Note: Although you can spoof e-mail by putting anything here, your installation has the ability to go back and track when you do this. Do not use this ability to spoof e-mail and think you can't get caught! SMF records are written and with a little research, the mail spoofer will be found out.

  • I intentionally leave the Date: SMTP command off. When IBM's SMTP task processes your note, it will add the date and time information if not found. I've seen that if the date SMTP command was not of the right format that MS-Exchange reports the wrong time.



Typically you won't use IEBGENER to send SMTP notes. This is just used for demonstration purposes. You would usually use a program of some type to send mail from an application that would fill in the email destination, sender, etc. and then put the item on the JES2 SPOOL.

SMTP links:

SMTPNOTE modification

The SMTPNOTE Rexx exec (found in DSN=TCPIP.SEZAINST) as delivered with the TCP/IP for MVS product, has to be customized by every installation because the hostname and smtpnode variables are set to an arbitrary value of "YKTVS". TSO/E at version 2.5 and higher has a function that will get the JES2/3 nodename. If you are at TSO/E 2.5 and higher, you could modify these two variable settings with this code:
   hostname = sysvar(sysnode)
   smtpnode = sysvar(sysnode)

Getting started with MIME

MIME, Multipurpose Internet Mail Extensions, is the standard for sending multipart, multimedia, and binary data using the world-wide Internet e-mail system. MIME is documented in RFC 1341.

To get you started sending simple MIME attachments from MVS, I've taken the simple MIME example from Mark Grand's MIME Overview and created the following batch job that uses IEBGENER to send a SMTP note with a MIME text attachment:

//SENDNOTE EXEC PGM=IEBGENER
//SYSIN    DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2   DD SYSOUT=(B,SMTP)
//SYSUT1   DD *
helo MVSHOST
mail from:
rcpt to:
data
From:     MVSUser@MVSHost.xyz.com
To:       unixuser@pop3.xyz.com
Subject:  Test message from MVS using SMTP (with MIME)
MIME-Version: 1.0
Content-type: multipart/mixed;
              boundary="simple boundary"

This is the preamble.  It is to be ignored, though it is
a handy place for mail composers to include an
explanatory note to non-MIME compliant readers.
--simple boundary

This is implicitly typed plain ASCII text.
--simple boundary
Content-type: text/plain; charset=us-ascii

This is explicitly typed plain ASCII text. It DOES end
with a line break.
--simple boundary--
This is the epilogue.  It is also to be ignored.


See the text following the first IEBGENER example for the things you will need to change.


Sending mail from MVS with fonts and colors using HTML

Most email clients can properly handle HTML (Hyper Text Markup Langauge) formated email. HTML is the language used in web pages. Here is an example of a jobstream that sends a SMTP note with a HTML MIME extension:

//SENDNOTE EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=(B,SMTP) //SYSUT1 DD * helo MVSHOST mail from:<MVSUser@MVSHost.xyz.com> rcpt to:<unixuser@pop3.xyz.com> data From: MVSUser@MVSHost.xyz.com To: unixuser@pop3.xyz.com Subject: Test message from MVS using SMTP (with HTML MIME) MIME-Version: 1.0 Content-type: multipart/mixed; boundary="simple boundary" You have received mail whose body is in the HTML Format. --simple boundary Content-type: text/html <font face="Courier" size="+2" color=blue> This is Courier font in blue</font> <br><br> <font face="Arial" size="+3" color=red> This is the Arial font in red</font> --simple boundary-- /*


See the text following the first IEBGENER example for the things you will need to change.


The note above would look something like this:

From:     MVSUser@MVSHost.xyz.com
To:       unixuser@pop3.xyz.com
Subject:  Test message from MVS using SMTP (with HTML MIME)
This is Courier font in blue

This is the Arial font in red



TSO XMIT/RECEIVE

IBM provides a couple of commands on TSO that allow you to send notes between MVS and VM systems called the TSO TRANSMIT (XMIT) and RECEIVE commands. I have a small write up on XMIT on my Terms page.

Simple XMIT/RECEIVE instructions:

Pretty simple stuff...

XMIT links and technical information:


MVS MAIL FAQ

I can't get the IEBGENER SMTP job to send mail. Can you help me?

You should ensure that the SMTP or CSSMTP task is correctly configured and operational at your site. If IBM's SMTPNOTE command doesn't send mail, the IEBGENER examples probably won't work either.


How do I see what mail is being processed by the SMTP task?

Turn on the DEBUG option in the SMTP config file


How do I see the queues being processed by the SMTP task?

One way is to TELNET into your MVS system to port 25. In Windows 9x, type in "TELNET mvshost 25" in your MS/DOS prompt and type in QUEU to get:
220 mvshost.mydomain running IBM MVS SMTP CS V2R6 on Sat, 21 Oct 00 17:00:52 CDT
250-Queues on mvshost.mydomain at 17:00:59 CDT on 10/21/00
250-Spool Queue: Empty
250-Undeliverable Queue: Empty
250-Resolution Queues:
250-Resolver Process Queue: Empty
250-Resolver Send Queue: Empty
250-Resolver Wait Queue: Empty
250-Resolver Retry Queue: Empty
250-Resolver Completed Queue: Empty
250-Resolver Error Pending Queue: Empty
250 OK
 
Then type QUIT to end.

Note: I've personally never seen any useful information here but that's how you are suppose to do it.



Disclaimers

The code samples and advice on this page are presented as is and without warranty. Please research any advice given here and ensure that it will work in your environment.

Most of the proceeding examples were created before the year 2000 on OS/390!

Email directly from native JCL New [2025-07-07]

Your systems programmer will need to customize the system for this to work. Here is an example:
//EMAIL    EXEC PGM=IEBGENER                  
//SYSPRINT DD DUMMY                            
//SYSIN    DD DUMMY                            
//SYSUT1   DD DISP=SHR,DSN=my.file     
//EMAIL  OUTPUT DEST=EMAIL2ME,                        
//  MAILTO=('Jimmy.Page@LedZep.com'),              
//  MAILFILE='stairway.txt'                            
//SYSUT2   DD SYSOUT=A,OUTPUT=*.EMAIL,OUTLIM=16000000 



Return to the Planet MVS home page



Last Updated: 2025-07-07
This web page is © 1997-2025+ by David Alcock. All Rights Reserved.