In the case of an e-mail without an attachment, the mail reader creates the following two files:
A file containing the e-mail’s message
A file containing the procedure for the processing of the e-mail.
The structure of the procedures created is largely freely configurable.
The mail reader generates a new name for each e-mail received.
The procedure is then called by means of an /ENTER-JOB
or /ENTER-PROCEDURE
command.
Example 1
This example shows how to configure the mail reader in such a way that the procedure created only has one line. All e-mails received are printed.
/PRINT-FILE MAIL.2010-06-27.073001,DELETE-FILE=*YES
MAIL.2010-06-27.073001 is the unique name under which the message text is stored.
Accordingly, the name of the procedure is MAIL.2010-06-27.073001.PROC.
The mail reader then calls the MAIL.2010-06-27.073001.PROC procedure, which in turn starts printout with /PRINT-FILE.
The corresponding section of the configuration file must look like this:
MAILHANDLING = PARAMETERS( ENTER = PROCEDURE, BODY= PARAMETERS ( PROCEDURE = PARAMETERS ( TEXT = ('/PRINT-FILE %FILE-NAME%,DELETE-FILE=*YES' ) ) ) )
The mail reader substitutes the keyword expression %FILE-NAME% with the current name of the message file.
Example 2
Most headers can also be substituted with such variables. In the following section from the configuration file, %SUBJECT%
is substituted with the subject of the e-mail:
TEXT = ('/PRINT-FILE %FILE-NAME%,DELETE-FILE=*YES,', '/ COVER-PAGES=PAR(HEADER-PAGE-TEXT=''Subject: %SUBJECT%'')' )
Two single quotes ( ' ' ) are substituted with one (') .
This results in the following procedure, for example:
/PRINT-FILE MAIL.2010-06-27.073001,DELETE-FILE=*YES,-
/ COVER-PAGES=PAR(HEADER-PAGE-TEXT='Subject:Mail-Reader 2010')
Example 3
The HANDLEMAIL procedure is called for each e-mail received. The subject and file name of the e-mail are passed as parameters.
The corresponding section of the configuration file looks like this, for example:
MAILHANDLING = PARAMETERS( ENTER = PROCEDURE, BODY = PARAMETERS ( PROCEDURE = PARAMETERS ( TEXT = ('/CALL-PROCEDURE HANDLEMAIL,(FILENAME=%FILE-NAME%,-', '/ Subject=''%SUBJECT%'')' ) ) ) )