CSSMTP user exit version 3

Use the Communication Server SMTP (CSSMTP) exit to check, and subsequently accept or reject, outbound mail from the JES spool data set. For example, you can code an exit to check the MAIL FROM: string on outbound mail.

CSSMTP uses the Dynamic Exit Facility (CSVDYNEX macro) provided by MVS™. See z/OS MVS Programming: Assembler Services Guide for more information.

The USEREXIT statement in the CSSMTP configuration, along with the MODIFY CSSMTP,USEREXIT command, defines which user exit is called by CSSMTP. For compatibility with the SMTP server, VERSION2 is provided. VERSION3 is provided to take advantage of the additional features provided by CSSMTP.

A sample VERSION3 user exit is included in member CSSMTPV3 in SEZAINST. The name of the macro is EZAYSMTP and the macro is located in SEZANMAC.

Table 1 provides a definition for the VERSION2 and VERSION3 user exits.
Table 1. USEREXIT comparisons
Feature SMTP server exit VERSION2 VERSION3
Dynamic Exit ExitName EZBTCPIPSMTPEXIT EZBTCPIPSMTPEXIT EZATCPIPCSSMTPV3
Macro EZBZSMTP.MACRO EZBZSMTP.MACRO EZAYSMTP.MACRO
RFC commands supported RFC 821 RFC 821 RFC 2821
Sample program SMTPEXIT.SAMPLE SMTPEXIT CSSMTPV3
Parameter list variables
Feature SMTP server exit VERSION2 VERSION3
EZBPACTN 1 - 18 1 -18 1 - 20
EABPBUFF Pointer to data buffer or 0 Pointer to data buffer or 0 Pointer to data buffer or 0
EZBPCNID 1 - 256, or 257 257 257
EZBPDLEN Length of data buffer or 0 Length of data buffer or 0 Length of data buffer or 0
EZBPIPV4 IP address or 0 Zero Zero
EZBPTOKN Zero or pointer to SAF Token Pointer to SAF token Pointer to SAF token
EZBPUSER User token from EZBAINIT call User token from EZBAINIT call User token from EZBAINIT call
EZBPVERS 2 2 3
Return codes
Feature SMTP server exit VERSION2 VERSION3
EZBRAGN (call exit again) Return code 0 Return code 0 Return code 0
EZBRACC (do not call exit again) Return code 4 Return code 4 Return code 4
EZBRREJ (Reject the JES spool file) Return code 8 Return code 8 Return code 8
EZBRMAIL(Reject a mail from spool file) NA NA Return code 12
Action code (value) passed to exit routines in EZBPACTN
Feature SMTP server exit VERSION2 VERSION3
EZBAINIT (1) Yes Yes Yes
EZBATERM (2) Yes Yes Yes
EZBADATA (3) Yes Yes Yes
EZBAEXPN (4) Yes No (command is not implemented) No (command is not implemented)
EZBAHELO (5) Yes Yes Yes
EZBAHELP (6) Yes No (command is not implemented) No (command is not implemented)
EZBAMAIL (7) Yes Yes Yes
EZBANOOP (8) Yes No (command is not implemented) No (command is not implemented)
EZBAQUEU (9) Yes No (command is not implemented) No (command is not implemented)
EZBAQUIT (10) Yes Yes Yes
EZBARCPT (11) Yes Yes Yes
EZBARSET (12) Yes Yes Yes
EZBATICK (13) Yes No (command is not implemented) No (command is not implemented)
EZBAVERB (14) Yes No (command is not implemented) No (command is not implemented)
EZBAVRFY (15) Yes No (command is not implemented) No (command is not implemented)
EZBADBUF (16) Yes Yes Yes
EZBAEODB (17) Yes Yes Yes
EZBACONN (18) Yes Yes Yes
EZBAEHLO (19) NA No Yes
EZBASTAR (20) NA No Yes

If the USEREXIT statement specifies VERSION2, then only RFC 821 syntax for the mail read from JES spool files is allowed. If the USEREXIT statement specifies VERSION3 or NONE, then RFC 821 and RFC 2821 syntax for the mail read from JES spool file is allowed. See USEREXIT statement for more information.

Information about programming the SMTPEXIT using VERSION2 can be found in Steps for using the SMTP server exits.

CSSMTPV3 is provided as a programming guide to aid in the implementation of the local policies. It can be found in SEZAINST. If using the CSSMTP exit, a name token (EZATCPIPCSSMTPV3) must be established in SYS1.PARMLIB(PROGxx). See z/OS MVS Initialization and Tuning Guide for more information.

You can use the SETPROG EXIT command to activate and deactivate EZATCPIPCSSMTPV3 exit routines. Seez/OS MVS System Commands for more information.

When you design the CSSMTP exit, consider some of the following design points. Code the exit as efficiently as possible; take all efforts to avoid excessive processing or waiting (for example. I/O operations and DNS resolver calls, while within the exit). Efforts to reject mail might be more efficient if extensive scanning of the data portion of the mail message can be avoided. The exit can allow processing to continue or reject the entire mail message and does not have the ability to reject individual segments of a mail message. The mail message contents cannot be changed in any way by the exit. The exit can accept a mail message at any point and disable further exit calls for that mail message. Only commands that are currently implemented by the CSSMTP program and that are syntactically correct are passed to the exit program.

Read and understand RFCs 2505 and RFC 2635 before undertaking this coding effort. More information about CSSMTP commands and standards are documented in RFCs 2821 and 2822.

The CSSMTP dynamically determines if a CSSMTP exit program exists. This determination is based upon the CSSMTP exit program association with the name token EZATCPIPCSSMTPV3 using the MVS SETPROG command. If you determine that the exit program needs to be called to interrogate data coming from the JES spool data set, follow these steps:

This topic describes how to call the exit program to interrogate data coming from the JES spool data set.

Perform the following steps to call the exit program to interrogate data coming from the JES spool data set:

  1. Add code to the user exit program so that the program is compatible with the JES connection.
    Rules:
    • The connection ID is always the value 257.
    • The EZBPIPV4 field that represents the remote IP address is always 0 for the JES connection.

    For SAF token information, the EZBPTOKP field contains the address of the token. The SAF token length is 80 bytes and the SAF token version is 1. The SAF token provides information about the submitting user ID and the submitter node of the JES data. This data can be compared to the sender information about the MAIL FROM: string. For more information about what is provided in the SAF token, see the ICHRUTKN information in z/OS Security Server RACF Data Areas.

    _________________________________________________________________

  2. Compile the user exit with the version 3 copy of the EZAYSMTP DSECT. This action recognizes the changes in the parameter list.

    _________________________________________________________________

  3. Write the exit in Assembler language. You must use standard z/OS® Assembler entry and exit linkage. See z/OS MVS Programming: Assembler Services Guide for the linkage conventions.

    _________________________________________________________________

A return code of 8 or 12 results in a reply message that is listed in the log and in the error report. The JES spool file is then subject to the action of the BadSpoolDisp statement. See BADSPOOLFILEID statement for details. See Registers at exit for details about exit return codes.

The user exit is passed by the generated undeliverable mail notification and the error report.

Restriction: This exit must be reentrant and amode 31 in an authorized library.

The exit is invoked with the settings shown in Table 2.

Table 2. CSSMTP user exit settings
Exit Description
Authorization Problem state
Dispatchable unit mode Task
Cross memory mode PASN=HASN
Amode 31-bit
ASC mode Primary address space control (ASC) mode
Interrupt status Enabled for interrupts
Locks Unlocked
Control parameters In the caller's primary address space