Skip to main content  
  Easy400   |       IBM System i home   |   RSS feed
Freeware
 
Introduction
Main utilities
    Infoprint Server
5250 utility
Windows utility
Commands
Service program
Sample code
CGI support
FAQ
WEBMail
Bibliography
Index
 
Download
 
 

 
Search   
MIME & Mail for IBM System i
Main utilities

Some common use utilies are documented in this page. These utilities are invoked through commands, which make their use in programs very easy. They are also rather straight forward coded, can be easily read, and provide a simple way to understand how mmail/sendmail service program subprocedures can be invoked.

You may also access these utilities through a menu: go mmail/mail .

Basic notes:

  • Important note on commands
    In order to be properly executed, all the following commands need the MMAIL library (or its clone library) be in the job library list.
  • Validation of e-mail addresses
    As a rule all MMAIL e-mail commands perform validation of the e-mail addresses (sender and recipients) and if an error is found, the message is not sent.
    In order to disable and to re-enable the e-mail addresses validation process, one should run command VLDEMLADDR.


Start your MMAIL experience with command MNGSPLF (Manage Spooled Files)

Command MNGSPLF lets you work with spooled file generated by a user profile (defaulted to the current user profile).
Besides providing some options as system command WRKSPLF (Change, Hold, Delete, Display, Release, Attributes), it features four more options to

  • e-mail a spooled file as text
  • e-mail a spooled file as PDF
  • convert a spooled file to a text stream file
  • convert a spooled file to a PDF
These four features take advantage of commands listed in this page.
More about MNGSPLF ...

0.Monitor MMAIL commands
1.E-mail a simple message
2.E-mail source members
3.E-mail spooled files
3b.Merge job spooled files
4.E-mail save files
5.E-mail stream files
6.Send a MIME file
7.Automated e-mailing of spooled files
7a.Automated e-mailing of spooled files, Version 2
8.Automated e-mailing of PDFs
9.Default message body for EML... commands
10.E-mailing SMS messages
11.Resend failed MIME messages
12.Converting spooled files to PDF
13.Converting spooled files to PC documents
14.Logging outbound e-mail messages
15.Archiving outbound e-mail messages
16.Displaying the log of outbound e-mail messages
17.Manage spooled files
18.Spooled File Actions
19.Convert a stream file
20.WEB utilities
 
21.Logging program messages





0. Monitor MMAIL commands
There are three reasons for MMAIL code receiving an escape message:
  1. Some error in a MMAIL command, detected by its command validity check program
  2. Some exception in the code itself, outside of its control
  3. MMAIL is facing a situation where it cannot do what requested. In this case MMAIL is still in control and sends an escape message telling what the problem is.

MMAIL does not use any Program Status SubRoutine (*PSSR). In this way the decision on what to do in case of error is left to the calling program or to the user.


There are two possible scenarios:
  1. Interactive environment. The process stops and the user receives the escape message.
  2. Batch environment.
    • If the submit command specified INQMSGRPY(*RQD) then the process stops and a message is sent tomessage queue QSYSOPR and waits for a reply.
    • If the submit command specified INQMSGRPY(*DFT), the control returns immediately to the calling program. Then either the calling program monitors for exceptions and decides what to do, or the calling program is halted by the escape message.
    Our suggestion for batch jobs using MMAIL is that they are submitted with INQMSGRPY(*DFT) and that the calling program monitors for exception events.
Display a sample CL program monitoring MMAIL commands.
Display a sample RPG program monitoring MMAIL commands.

1. E-mail a simple message
Three commands are available:
  • MMAIL/EMLMSG, which e-mails a message with the text from a source member or from a stream file
  • MMAIL/EMLPTUMSG, which e-mails a message with an impromptu text. The message is encoded as BASE64. The user-specified character set is used.
  • MMAIL/EMLQPMSG, which e-mails a message with an impromptu text. The message is encoded as Quoted-Printable. The character set UTF-8 is used.

Command MMAIL/EMLMSG allows to e-mail a plain text message - resulting from a text source file member or stream file - to a maximum of 50 receivers.

Command MMAIL/EMLMSG
                       E-mail simple message (EMLMSG)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE            
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____        *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values  ____
 Text source file . . . . . . . .   *DFT____    Name, *DFT
   Library  . . . . . . . . . . .     *LIBL____ Name, *LIBL,
                                                      *CURLIB
 Text source member . . . . . . .   ________    Name
 Edit source member . . . . . . .   *YES       *YES, *NO
 Text stream file . . . . . . . .   *NONE                         
      
 Edit text stream file  . . . . .   *YES       *YES, *NO
 Importance . . . . . . . . . . .   *MED       *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM       *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM       *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_       *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
 Character set  . . . . . . . . .   *DFT________________
 Preformatted message body  . . .   N          N, Y
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message (see Note 3 below)
Sender's address: E-mail address of the person sending the message (see Note 3 below)
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:
  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
Text source file: (instead of specifying a text source file, you may specify a text stream file, see parameter "Text stream file")
Qualified name of the source file with the member containing the text to be e-mailed. If '*DFT' specified, library name and text source member name need not be specified: a QTEMP source file is generated and a default member name is assigned. *DFT is not supported in batch execution.
Text source member: name of the source member containing the text to be sent with the message.
Open a remark about writing the message text.
Edit source member: if EDTSRCM(*YES) and an interactive job, command STRSEU (Start Source Entry Utility) is used to edit the source member.
If however command STRSEU is not available, the user is sent a display file screen that allows to edit the source member. If the user presses F3 from this screen, then command EDTF (Edit File) is used to edit the source member.
Text stream file: (instead of specifying a text stream file, you may specify a text source file, see parameter "Text source file")
Stream file containing the text making up the body of the message.
Edit text stream file: Type *YES to edit or simply check the text of the stream file.
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Character set: A character set supporting your national language.
  • If you specify *DFT, the default character set (specified by command MMAIL/CHARSET) will be used.
  • You may specify a different character set, if you wish. For a list of supported character sets see this page.
Preformatted message body: Whether the message body should be presented as preformatted text. A preformatted text is a text where all characters (including spaces) have the same width. Examples are texts including text tables (not html tables, of course).

Example:

MMAIL/EMLMSG SUBJECT('Announcement of a new software') FROMNAME('John Evans') FROMADDR('jevans@mail.com') TO('dooley@superstar.com'/'Tom Dooley'/*TO) TXTF(QGPL/MESSAGES) TXTMBR(MSG705) RECEIPT(*YES)

Note 1. This command can run both in the interactive and in the batch environment.
Note 2. When running interactive, the source member is edited prior to sending the message.
Note 3- Fetching sender's name and e-mail from the system distribution directory
If the current user profile is enrolled in the system distribution directory (you may use command WRKDIRE to check it out) and its directory entry specifies a full name and an e-mail address (use F19 and check fields titled "SMTP user ID" and "SMTP domain"), then the sender's name and e-mail address are automatically fetched into command parameters FROMNAME and FROMADDR when the command is prompted.
(Command WRKNAMSTP, alias table type = system, provides another way to display / maintain e-mail addresses)
If the command is executed without prompting, to obtain the same you must specify FROMNAME(*DIRENT) FROMADDR(*DIRENT). In this case, if the required information cannot be retrieved from the system distribution directory entry for the current user profile, an escape message is issued.
Example:
MMAIL/EMLMSG SUBJECT('Announcement of a new software') FROMNAME(*DIRENT) FROMADDR(*DIRENT) TO('dooley@superstar.com'/'Tom Dooley'/*TO) TXTF(QGPL/MESSAGES) TXTMBR(MSG705) RECEIPT(*YES)
Note 4. Some programmers have problems when trying to dynamically build command MMAIL/EMLMSG in a program. This is mainly due to the fact that they would use CL language to obtain the result. ILE-RPG is a much better language for that. As an example, see source member EMLMSG123 in MMAIL/SAMPLERPG.

Command MMAIL/EMLPTUMSG allows to e-mail an impromptu text to a maximum of 50 receivers.
The message is encoded as BASE64. The user-specified character set is used.

Command MMAIL/EMLPTUMSG
                     E-mail impromptu message (EMLPTUMSG)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE            
 Sender's e-mail address  . . . .   ______________________________
 Recipient e-mail addresses . . .   ______________________________
                + for more values  ____
 'Message text' . . . . . . . . .   ______________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
________________________________________________________  ...
 Return receipt . . . . . . . . .   *NO_       *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
 Character set  . . . . . . . . .   *DFT________________
 Preformatted message body  . . .   N          N, Y
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message (see Note 3 below)
Sender's address: E-mail address of the person sending the message (see Note 3 below)
Recipient e-mail addresses: up to 50 recipient e-mail addresses can be specified. Message text - Specify the text (5000 characters maximum, within quotes) to send to the recipients.
The text must be formatted by using the following controls within the text:
  • :/N - Will cause a new line (Carrier return)
  • :/P - Will cause a new paragraph. New line plus a blank line.
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Character set: A character set supporting your national language.
  • If you specify *DFT, the default character set (specified by command MMAIL/CHARSET) will be used.
  • You may specify a different character set, if you wish. For a list of supported character sets see this page.
Preformatted message body: Whether the message body should be presented as preformatted text. A preformatted text is a text where all characters (including spaces) have the same width. Examples are texts including text tables (not html tables, of course).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching e-mail address from the system distribution directory
If the current user profile is enrolled in the system distribution directory (you may use command WRKDIRE to check it out) and its directory entry specifies a full name and an e-mail address (use F19 and check fields titled "SMTP user ID" and "SMTP domain"), then the sender's e-mail address is automatically fetched into command parameter FROMADDR when the command is prompted.
(Command WRKNAMSTP, alias table type = system, provides another way to display / maintain e-mail addresses)
If the command is executed without prompting, to obtain the same you must specify FROMADDR(*DIRENT).

Command MMAIL/EMLQPMSG allows to e-mail an impromptu text to a maximum of 50 receivers.
The message is encoded as Quoted-Printable. Character set UTF-8 is used.

Command MMAIL/EMLQPMSG
                     E-mail Quoted-Printable message (EMLQPMSG)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Sender's e-mail address  . . . .   ______________________________
 Recipient e-mail addresses . . .   ______________________________
                + for more values  ____
 'Message text' . . . . . . . . .   ______________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
________________________________________________________  ...
Subject: Subject of the message
Sender's name: Name of the person sending the message (see Note 3 below)
Sender's address: E-mail address of the person sending the message (see Note 3 below)
Recipient e-mail addresses: up to 50 recipient e-mail addresses can be specified. Message text - Specify the text (5000 characters maximum, within quotes) to send to the recipients.
The text may be formatted by using the following control within the text:

  • %LF% - Will cause a new line (Carrier-Return-Line-Feed).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching e-mail address from the system distribution directory
If the current user profile is enrolled in the system distribution directory (you may use command WRKDIRE to check it out) and its directory entry specifies a full name and an e-mail address (use F19 and check fields titled "SMTP user ID" and "SMTP domain"), then the sender's e-mail address is automatically fetched into command parameter FROMADDR when the command is prompted.
(Command WRKNAMSTP, alias table type = system, provides another way to display / maintain e-mail addresses)
If the command is executed without prompting, to obtain the same you must specify FROMADDR(*DIRENT).




2. E-mail source members

Command MMAIL/EMLSRCM allows to e-mail a message attaching up to 30 source members. Optionally, a message body may be built from another text source member. The message can be e-mailed up to 50 receivers.

Command MMAIL/EMLSRCM
                    E-mail source members (EMLSRCM)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____        *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 Source member to be attached . .   __________    Name
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
                + for more values   __________
 Source mbr for message body  . .   *NONE_____    Name, *DFT, *NONE
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Edit message body src mbr  . . .   *NO_          *NO, *YES
 Importance . . . . . . . . . . .   *MED        *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM        *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM        *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR____________________
 Return receipt . . . . . . . . .   *NO_        *NO, *YES
 Save directory . . . . . . . . .   /mmail/history_______________
 Preformatted message body  . . .   N           N, Y

Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:
  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
Source member to be attached: up to 30 attachments can be specified; for each attachment the following must be given:
  • source member name
  • source file name
  • source library name
Source mbr for message body: member, file, and library name for the text to become the body of the message.
If *NONE specified, the message will have no body, just the attachment will be there.
If '*DFT' specified, library name and text source member name need not be specified: a QTEMP source file is generated and a default member name is assigned. *DFT is not supported in batch execution.
Open a remark about writing the message text.
Edit message body src mbr: if EDTSRCM(*YES) and an interactive job, command STRSEU (Start Source Entry Utility) is used to edit the source member.
If however command STRSEU is not available, the user is sent a display file screen that allows to edit the source member. If the user presses F3 from this screen, then command EDTF (Edit File) is used to edit the source member.
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Preformatted message body: Whether the message body should be presented as preformatted text. A preformatted text is a text where all characters (including spaces) have the same width. Examples are texts including text tables (not html tables, of course).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

Example:

MMAIL/EMLSRCM SUBJECT('Source of command MMAIL/EMLSRCM')
FROMNAME('John Evans') FROMADDR('jevans@mail.com')
TO('dooley@superstar.com'/'Tom Dooley'/*TO)
SRCM(MMAIL/QCMDSRC/EMLSRM)





3. E-mail spooled files

Three similar commands are available. They differ in the way the PDF conversion utility is selected.

  • MMAIL/EMLSPL
    This command selects the PDF conversion utility defined by command MMAIL/CVTTOPDF, and lets you define a single name for all the attached PDF's.
    The message body is optional and its contents come from a source member.
  • MMAIL/EMLSPL2
    This command selects the PDF conversion utility defined by command MMAIL/CVTTOPDF, and lets you define a name for each attachment.
    The message body is optional and its contents come from a source member.
  • MMAIL/EMLSPL3
    This command selects the PDF conversion utility defined by command MMAIL/CVTTOPDF, and lets you define a name for each attachment.
    The message body is mandatory and its contents come from a text or an HTML stream file.
  • MMAIL/EMLSPLX
    This command, though defaulting to the PDF conversion utility selected by command MMAIL/CVTTOPDF, leaves you the freedom to select a different conversion utility. Besides, when the PDF conversion utility CVTSPLSTMF is selected, it provides all the needed PDF formatting parameters.
    The message body is optional and its contents come from a source member.

A - Command MMAIL/EMLSPL allows to e-mail a message attaching up to 30 spooled files. A conversion to PDF option is available at single spooled file level. Optionally, a message body may be built from a text source member. The message can be e-mailed up to 50 receivers.

Command MMAIL/EMLSPL
                         E-mail spooled files (EMLSPL)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 Spooled file . . . . . . . . . .   __________    Name
   Job name . . . . . . . . . . .     *CURRENT__  Name, *CURRENT
     job user . . . . . . . . . .     __________  Name
     job number . . . . . . . . .     ______      000000-999999
   Spooled file number  . . . . .     *LAST       1-9999, *ONLY, 
                                                  *LAST, *PDF
   Convert spool file to PDF  . .     *NO_        *NO, *YES
                + for more values   __________
 Source mbr for message body  . .   *NONE_____    Name, *DFT, *NONE
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Edit message body src mbr  . . .   *NO_          *NO, *YES
 Importance . . . . . . . . . . .   *MED        *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM        *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM        *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR____________________
 Return receipt . . . . . . . . .   *NO_        *NO, *YES
 Save directory . . . . . . . . .   '/mmail/history'_____________
 PDF save directory . . . . . . .   '/mmail/temp'________________
 PDF save prefix  . . . . . . . .   'abc'________________________
 PDF name . . . . . . . . . . . .   'sample.pdf'_________________
 Preformatted message body  . . .   N           N, Y
 Zip attachments  . . . . . . . .   N           N, Y

Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:
  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
Spooled file: up to 30 attachments can be specified; for each attachment the following must be given:
  • spooled file name
  • qualified job name
  • spooled file number (number, *ONLY or *LAST)
    E-mailing a PDF - If you specify *PDF as spooled file number, the object to be sent is interpreted to be a PDF instead of a spool file. In such a case:
    1. The name of the PDF is assumed to be /mmail/pdf/xxx.pdf, where xxx is the spooled file name specified in the command.
    2. The parameter JOB is ignored.
    3. The PDF is deleted after having been sent.
  • whether the spooled file should be converted to PDF before being attached to the message.
    Information about conversion of spooled files to PDF's is provided later in this page.
    The spool_file_to_PDF conversion program used in this process is the utility selected through command MMAIL/CVTTOPDF.
    Note 1- For additional parameters of command CVTSPLSTMF when spooled file conversion to PDF is requested, see Note on CVTSPLSTMF spooled file conversion to PDF.
    Note 2- If the conversion utility specified by command CVTTOPDF is CVTSPLSTMF (which handles only *SCS, *IPDS, *LINE, and *AFPDSLINE spooled files) and the spooled file type is *AFPDS, then utility CVTSPLFPDF (which handles both *SCS and *AFPDS spooled files) is used instead.
    Note 3- If the conversion utility specified by command CVTTOPDF is CVTSPLFPDF (which handles only *SCS and *AFPDF spooled files) and the spooled file type is *IPDS, *LINE, or *AFPDSLINE, then utility CVTSPLSTMF is used instead.
    Note 4- If the conversion utility specified by command CVTTOPDF is the AFP TO PDF TRANSFORM FEATURE, then utility CVTSPLFPDF is used instead, because the transform feature cannot be used on existing spooled files.
Source mbr for message body: member, file, and library name for the text to become the body of the message.
If *NONE specified, the message will have no body, just the attachment will be there.
If '*DFT' specified, library name and text source member name need not be specified: a QTEMP source file is generated and a default member name is assigned. *DFT is not supported in batch execution.
Open a remark about writing the message text.
Edit message body src mbr: if EDTSRCM(*YES) and an interactive job, command STRSEU (Start Source Entry Utility) is used to edit the source member.
If however command STRSEU is not available, the user is sent a display file screen that allows to edit the source member. If the user presses F3 from this screen, then command EDTF (Edit File) is used to edit the source member.
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
PDF save directory: The PDF is deleted after been attached to the MIME file. However, you may specify an IFS directory where it should be saved before been deleted.
PDF save prefix: Optional parameter to specify a prefix string for the name of the PDF to be saved in an IFS directory. PDF name:
  • if you leave the default value *AUTO, all the PDF's are assigned a single computed name
  • you may specify a single pdf name of your choice ending with the extension .pdf .
In both cases, the final name of an attached PDF is the assigned name, preceeded by a sequence number.
Preformatted message body: Whether the message body should be presented as preformatted text. A preformatted text is a text where all characters (including spaces) have the same width. Examples are texts including text tables (not html tables, of course).
Zip attachments: Whether the attached spooled files should be zipped (compressed).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

Example:

MMAIL/EMLSPL SUBJECT('Daily sales report')
FROMNAME('John Evans') FROMADDR('jevans@mail.com')
TO('dooley@superstar.com'/'Tom Dooley'/*TO)
SPLF(*YES/*LAST/*N/*N/*CURRENT/QSYSPRT)




B - Command MMAIL/EMLSPL2 is similar to command MMAIL/EMLSPL, except that each attachment can be assigned its own name.

Command MMAIL/EMLSPL2
                         E-mail spooled files (EMLSPL2)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 Spooled file . . . . . . . . . .   __________    Name
   Job name . . . . . . . . . . .     *CURRENT__  Name, *CURRENT
     job user . . . . . . . . . .     __________  Name
     job number . . . . . . . . .     ______      000000-999999
   Spooled file number  . . . . .     *LAST       1-9999, *ONLY, *LAST
   Attachment name  . . . . . . .     *AUTO_______________________
______________________________________
   Convert spool file to PDF  . .     *NO_        *NO, *YES
   PDF save directory . . . . . .     *NONE_______________________
______________________________________
   ZIP attachment . . . . . . . .     N           N, Y
                + for more values   __________
 Source mbr for message body  . .   *NONE_____    Name, *DFT, *NONE
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Edit message body src mbr  . . .   *NO_          *NO, *YES
 Importance . . . . . . . . . . .   *MED        *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM        *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM        *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_        *NO, *YES
 Save directory . . . . . . . . .   '/mmail/history'______________
 Prefix for all saved PDFs  . . .   'abc'_________________________
 Preformatted message body  . . .   N           N, Y




C - Command MMAIL/EMLSPL3.
It is the same as command
EMLSPL2, the only difference being that EMLSPL3 has a mandatory body which is built from a stream file. A separate parameter allows to specify whether the stream file contains some plain text or an HTML script.



D - Command MMAIL/EMLSPLX allows to e-mail a message attaching up to 50 spooled files and can be e-mailed up to 50 receivers. Optionally, a message body may be built from a text source member.
It includes the same parameters as command EMLSPL. However:

Example:

MMAIL/EMLSPLX SUBJECT('Daily sales report')
FROMNAME('John Evans') FROMADDR('jevans@mail.com')
TO('dooley@superstar.com'/'Tom Dooley'/*TO)
SPLF(*LAST/*N/*N/*CURRENT/QSYSPRT)
CVTPDF(*YES) MSGM(*DFT)
PDFUTILITY(*CVTSPLSTMF)
PAGESIZE(*CUSTOM) CUSTOMPAGE(200 300) FONT(*COURIER 8)





3b. Merge job spooled files

Suppose that you periodically send -to some user of yours- an e-mail message attaching several spooled files (converted to PDF).
Also suppose that your user would better like to receive those printouts in a single spooled file (converted to PDF).
MMAIL features a command that merges several spooled files into a single spooled file, provided that

  • all the spooled files are generated in a single job
  • thar are all *SCS and are in a *READY status.
This MMAIL command is named MRGJOBSPLF and prompts as follow:

                         Merge *SCS job spooled files (MRGJOBSPLF)

 Type choices, press Enter.

 Job  . . . . . . . . . . . . . .  JOB       *CURRENT      Name, *CURRENT
     job user . . . . . . . . . .                          Name
     job number . . . . . . . . .                          000000-999999
 Spool files to be included . . .  INCLUDE   *ALL          Name, generic*, *ALL 
                + for more values                      
 Spool files to be excluded . . .  EXCLUDE   *NONE         Name, generic*, *NONE 
                + for more values                      
 Delete merged spool files  . . .  DLTFILES  *NO           *YES, *NO


This command merges *SCS spooled files generated from a given job and with *READY status into a single spooled file named JOBSPLFS .
Job - Qualified job name (job name, job user, job number) of the job that created the spooled files to be merged, or *CURRENT to indicate the current job.
spooled files to be included - Specify up to 50 names of spooled files to be included in the merge operation OR specify *ALL to include all the *READY spooled files.
  • INCLUDE spooled file names do not need to be all available when this command is executed.
  • If you specify some INCLUDE spooled file names, then you must also specify EXCLUDE(*NONE).
spooled files to be excluded - Specify up to 50 names of spooled files to be excluded from the merge operation OR specify *NONE.
  • EXCLUDE spooled file names do not need to be all available when this command is executed.
  • If you specify some EXCLUDE spooled file names, then you must also specify INCLUDE(*ALL).
Delete spooled files - Whether the merged spooled files should be deleted once the "single" spooled file has been generated




4. E-mail save files

Command MMAIL/EMLSAVF allows to e-mail a message attaching up to 30 save files. Optionally, a message body may be built from a text source member. The message can be e-mailed up to 50 receivers.

Command MMAIL/EMLSAVF
                         E-mail save files (EMLSAVF)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 Save file  . . . . . . . . . . .   __________    Name
   Library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
                + for more values   __________
 Source mbr for message body  . .   *NONE_____    Name, *DFT, *NONE
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Edit message body src mbr  . . .   *NO_          *NO, *YES
 Importance . . . . . . . . . . .   *MED          *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM          *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM          *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_          *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
 Preformatted message body  . . .   N             N, Y
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:

  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
Save file: up to 30 attachments can be specified; for each attachment the following must be given:
  • save file name
  • library name
Source mbr for message body: member, file, and library name for the text to become the body of the message.
If *NONE specified, the message will have no body, just the attachment will be there.
If '*DFT' specified, library name and text source member name need not be specified: a QTEMP source file is generated and a default member name is assigned. *DFT is not supported in batch execution.
Open a remark about writing the message text.
Edit message body src mbr: if EDTSRCM(*YES) and an interactive job, command STRSEU (Start Source Entry Utility) is used to edit the source member.
If however command STRSEU is not available, the user is sent a display file screen that allows to edit the source member. If the user presses F3 from this screen, then command EDTF (Edit File) is used to edit the source member.
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Preformatted message body: Whether the message body should be presented as preformatted text. A preformatted text is a text where all characters (including spaces) have the same width. Examples are texts including text tables (not html tables, of course).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

Example:

MMAIL/EMLSAVF SUBJECT('Save file QGPL/MYLIB') FROMNAME('John Evans') FROMADDR('jevans@mail.com')
TO('dooley@superstar.com'/'Tom Dooley'/*TO)
FILE(QGPL/MMAIL)





5. E-mail stream files

There are four commands for e-mailing stream files.

  • EMLSTMF creates the body of the mail message from a text source member. It can attach up to 30 stream files.
  • EMLSTMF2 is similar to EMLSTMF, but it allows for 256 characters (instead of only 100) for the e-mail addresses.
  • EMLHTML creates the body of the mail message from a HTML stream file. No attachments are allowed.
  • EMLHTML2 creates the body of the mail message from a HTML stream file. It can attach up to 30 stream files.
  • EMLTXTSTMF creates the body of the mail message from a TEXT stream file. It can attach up to 30 stream files.

5a- Command MMAIL/EMLSTMF - E-mail a source member as a body with stream files attached.
It allows to e-mail a message attaching up to 30 ASCII stream files. Optionally, a message body may be built from a text source member. The message can be e-mailed up to 50 receivers (the maximum length of the e-mail addresses is 50 characters).

Command MMAIL/EMLSTMF
                        E-mail stream files (EMLSTMF)
  Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
'Stream file'  . . . . . . . . .    ______________________________
                + for more values   ______________________________
 Source mbr for message body  . .   *NONE_____    Name, *DFT, *NONE
   source file  . . . . . . . . .     __________  Name
   library  . . . . . . . . . . .     *LIBL_____  Name, *LIBL, *CURLIB
 Edit message body src mbr  . . .   *NO_          *NO, *YES
 Importance . . . . . . . . . . .   *MED          *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM          *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM          *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_          *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
 Zip the attachments  . . . . . .   N             Y, N
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:

  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
Stream file: up to 30 stream files can be attached to the message. All the stream files to be attached must be in ASCII characters (CCSID 819 or 1252).
Source mbr for message body: member, file, and library name for the text to become the body of the message.
If *NONE specified, the message will have no body, just the attachment will be there.
If '*DFT' specified, library name and text source member name need not be specified: a QTEMP source file is generated and a default member name is assigned. *DFT is not supported in batch execution.
Open a remark about writing the message text.
Edit message body src mbr: if EDTSRCM(*YES) and an interactive job, command STRSEU (Start Source Entry Utility) is used to edit the source member.
If however command STRSEU is not available, the user is sent a display file screen that allows to edit the source member. If the user presses F3 from this screen, then command EDTF (Edit File) is used to edit the source member.
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Zip the attachments: whether the attached stream files should be zipped (compressed).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2. When running interactive, if *NONE not specified, the text source member for the body is edited prior to sending the message.
Note 3- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

Example:

MMAIL/EMLSTMF
 SUBJECT('My IFS file') 
 FROMNAME('John Evans') >
 FROMADDR('jevans@mail.com') >
 TO('dooley@superstar.com'/'Tom Dooley'/*TO) 
 STMF('/mydir/myphoto.gif')




5b- Command MMAIL/EMLSTMF2 - E-mail a source member as a body with stream files attached (2).
It allows to e-mail a message attaching up to 30 ASCII stream files. Optionally, a message body may be built from a text source member. The message can be e-mailed up to 50 receivers.
This command is the same as EMLSTMF, the only difference being that the maximum length of the e-mail addresses is 256 characters instead of 100.



5c- Command MMAIL/EMLHTML - E-mail a HTML stream file as a body, no attachments.
It allows to e-mail a HTML stream file (a HTML page) as body of the message, thus resulting in a high quality message. The message can be e-mailed up to 50 receivers (the maximum length of the e-mail addresses is 50 characters). No attachments are allowed.

Command MMAIL/EMLHTML
                      E-mail HTML stream file (EMLHTML)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 'HTML stream file' . . . . . . .   ______________________________
 Importance . . . . . . . . . . .   *MED        *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM        *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM        *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_        *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:

  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
HTML stream file: HTML stream file to be embedded in the body of the message
Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

Example:

MMAIL/EMLHTML
 SUBJECT('My HTML page')
 FROMNAME('John Evans')
 FROMADDR('jevans@mail.com')
 TO('dooley@superstar.com'/'Tom Dooley'/*TO)
 STMF('/mydir/mypage.html')




5d- Command MMAIL/EMLHTML2 - E-mail a HTML stream file as a body with stream files attached.
It allows to create and to e-mail a mail message made of

  • a HTML stream file (a HTML page) embedded in the body of the MIME message (thus resulting in a high quality message)
  • up to 30 attached stream files.
The message can be e-mailed up to 50 receivers (the maximum length of the e-mail addresses is 50 characters).

Command MMAIL/EMLHTML2
                 E-mail HTML stream file with attach.s (EMLHTML2)

 Type choices, press Enter.

 'Subject'  . . . . . . . . . . .   ______________________________
____________________________________
 Subject icon . . . . . . . . . .   *NONE_____________
 'Sender's name'  . . . . . . . .   ______________________________
 'Sender's e-mail address'  . . .   ______________________________
 Recipients . . . . . . . . . . .   ____          *TO, *CC, *BC
   'name' . . . . . . . . . . . .     ____________________________
   'e-mail address' . . . . . . .     ____________________________
                + for more values   ____
 HTML stream file . . . . . . . .   ______________________________
 Attached stream file(s)  . . . .   ______________________________
                + for more values   ____
 Importance . . . . . . . . . . .   *MED        *LOW, *MED, *HIG
 Priority . . . . . . . . . . . .   *NRM        *NUR, *NRM, *URG
 Sensitivity  . . . . . . . . . .   *NRM        *NRM, *PRS, *PRV, *CNF
 'Reply-to e-mail address'  . . .   *FROMADDR_____________________
 Return receipt . . . . . . . . .   *NO_        *NO, *YES
 Save directory . . . . . . . . .   /mmail/history________________
 Zip the attachments  . . . . . .   N           Y, N
Subject: Subject of the message
Subject icon: You may optionally specify the name of an icon to be displayed in front of the message subject.
The name of the icon must be that of an icon documented in file MMAIL/SICONS.
The list of the available icon names is published on this page.
Note. If you do not explicitly specify the name of an icon in this parameter, the default subject icon - specified by command MMAIL/DFTSICON - will be taken, if available.
Sender's name: Name of the person sending the message
Sender's address: E-mail address of the person sending the message
Recipients: up to 50 recipients can be specified; for each recipient the following must be given:

  • destination type: *TO, *CC, or *BC
  • recipient name, within quotes
  • e-mail address, within quotes
HTML stream file: HTML stream file to be embedded in the body of the message
Attached stream file(s): up to 30 stream files to be attached Importance: *LOW=low, *MED=medium, *HIG=high
Priority: *NUR=non-urgent, *NRM=normal, *URG=urgent
Sensitivity: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential
(use command mmail/setconfid to set the confidentiality statement).
Reply-to e-mail address: E-mail address of the person to receive reply messages, if different from the sender
Return receipt: whether a receipt should be returned to the sender when the recipient opens the message.
Save directory: IFS directory to contain a copy of the e-mailed MIME file, or *NONE .
Zip the attachments: whether the attachments should be zipped (compressed).

Note 1. This command can run both in the interactive and in the batch environment.
Note 2- Fetching sender's name and e-mail from the system distribution directory
See Note 3 for command EMLMSG.

5e- Command MMAIL/EMLTXTSTMF - E-mail a TEXT stream file as a body with stream files attached.
This command is similar to command EMLHTML2. Instead of using a HTML stream file, it uses a TEXT stream file for the body of the message. It also allows to attach up to 30 stream files.




6. Send a MIME file

Command SENDMIME allows to mail -through a single MIME message- a combination of different types of objects:

  • IFS stream files
  • Database files
  • Source file members
  • spooled files
  • spooled files converted to PDF
Up to 100 different pieces (objects) can be sent for each type of object.

Command MMAIL/SENDMIME
                      Send a MIME file (SENDMIME)

 Type choices, press Enter.

 Subject  . . . . . . . . . . . .   ______________________________
 From:
   Sender Name  . . . . . . . . .   ______________________________
   Sender Address . . . . . . . .   ______________________________
 To:
   Send TO, CC or BC  . . . . . .   ____   *TO, *CC, *BC
   Receiver Name  . . . . . . . .   ______________________________
   Receiver Address . . . . . . .   ______________________________
                + for more values   _
 IFS file to attach:
   Send as Text or Binary . . . .   *TEXT
                                                 *BIN, *TEXT
   Content Type . . . . . . . . .   *ATTACHED_   *ATTACHED, *BODY
   Mime type  . . . . . . . . . .   ______________________________
   IFS File Name  . . . . . . . .   ______________________________
   Character Set  . . . . . . . .   *SAME_________________________
   New Extension  . . . . . . . .   ___          Character value
   Content ID . . . . . . . . . .   _____        0-999
                + for more values   _
 Database file to attach:
   Content Type . . . . . . . . .   *ATTACHED_   *ATTACHED, *BODY
   File Name  . . . . . . . . . .   __________   Character value
   File Library . . . . . . . . .   __________   Character value
   File Member  . . . . . . . . .   __________   Character value
   Content ID . . . . . . . . . .   ____         0-999
                + for more values   _
 Source file to attach:
   Content Type . . . . . . . . .   *ATTACHED_   *ATTACHED, *BODY
   Source File Name . . . . . . .   __________   Character value
   Source Library . . . . . . . .   __________   Character value
   Source Member  . . . . . . . .   __________   Character value
   Character Set  . . . . . . . .  *SAME_________________________
   Content ID . . . . . . . . . .   _____        0-999
                + for more values   _
 Spool file to attach:
   Content Type . . . . . . . . .   *ATTACHED_   *ATTACHED, *BODY
   Spool File Name  . . . . . . .   __________   Character value
   Spool Number . . . . . . . . .   ______       Character value
   Spool Job Name . . . . . . . .   __________   Character value
   Spool Job User . . . . . . . .   __________   Character value
   Spool Job Number . . . . . . .   ______       Character value
   Content ID . . . . . . . . . .   _____        0-999
                + for more values   _
 Convert spool to PDF:
   Spool File Name  . . . . . . .   __________   Character value
   Spool Number . . . . . . . . .   ______       Character value
   Spool Job Name . . . . . . . .   __________   Character value
   Spool Job User . . . . . . . .   __________   Character value
   Spool Job Number . . . . . . .   ______       Character value
   Content ID . . . . . . . . . .   _____        0-999
   PDF Name . . . . . . . . . . .   _____________________________
   Save Directory . . . . . . . .   _____________________________
                + for more values   _
 Importance . . . . . . . . . . .   MEDIUM____   LOW, MEDIUM,
                                                 HIGH
 Priority . . . . . . . . . . . .   NORMAL____   NONURGENT,
                                                 NORMAL, URGENT
 Disposition notify to:
   Notify Name  . . . . . . . . .   *NONE________________________
   Notify Address . . . . . . . .   *NONE________________________
 Reply to:
   Reply to Email . . . . . . . .   *NOREPLY_____________________
 Invalid Emails . . . . . . . . .   SEND__       SEND, REMOVE
 Work Directory . . . . . . . . .   _____________________________
 Save Directory . . . . . . . . .   *NOSAVE______________________




7. Automated e-mailing of spooled files

Suppose that your iSeries produces regularly some reports that you need to distribute to some people in your organization. Why not to have a utility that automatically sends such reports to them by e-mail, as soon as they become available?

MMAIL has a utility for that. This is how you use it.

  1. Use command MMAIL/WRKADDR to define the e-mail addresses of your users
  2. Use command MMAIL/WRKGRP to define Groups of addresses (distribution lists)
  3. The pivot of spooled files distribution is a data queue. You may create a data queue and associate it to one or more output queues. Every time a spooled file is made ready in one of these output queues, an entry is generated in the data queue. Our utility receives the data queue entries and (selectively) e-mails the spooled files to their destinations.
    • To create an data queue,
          crtdtaq libxxx/dtaqyyy maxlen(500) aut(*change)
    • To associate a data queue to an output queue,
          chgoutq libaaa/outqbbb dtaq(libxxx/dtaqyyy)
  4. Command MMAIL/STREMLSPLF DTAQ(libxxx/dtaqyyy)
    (see later) starts e-mailing spooled files
  5. Command MMAIL/ENDEMLSPLF DTAQ(libxxx/dtaqyyy)
    ends e-mailing spooled files

Command MMAIL/STREMLSPLF
                   Start E-Mailing Spooled Files (STREMLSPLF)

Type choices, press Enter.

'Sender's name'  . . . . . . . . FROMNAME   _________________________
'Sender's e-mail address'  . . . FROMADDR   _________________________
Data queue . . . . . . . . . . . DTAQ                     Name
  Library  . . . . . . . . . . .              *LIBL       Name, *LIBL,
                                                         *CURLIB
Cvt to PDF all spool files . . . CVTPDF     *YES         *NO, *YES
Remove e-mailed spool files  . . RMVSPLF    *YES         *YES, *NO
MIME message disposition . . . . DISP       *ATTACH      *IMBED,
                                                         *ATTACH
Importance . . . . . . . . . . . IMPORTNC   *MED         *LOW, *MED,
                                                         *HIG
Priority . . . . . . . . . . . . PRIORITY   *NRM         *NUR, *NRM,
                                                         *URG
Sensitivity  . . . . . . . . . . SENSITIV   *NRM         *NRM, *PRS,
                                                         *PRV, *CNF
Spooled files timing . . . . . . SPLFTIME   *JOBSTR       *JOBSTR, *ANY
Spooled files and groups:        SPLFSND     
                                                          Name,
                                                           generic*
                                                                 
                          + for more values  
Subject icon option  . . . . . . SICONOPT   *YES          *YES, *NO
Select from User Data  . . . . . CHKUSRDTA  *NO          *NO, *YES
Subject type   . . . . . . . . . SBJTYPE    A            A, B, C
PDF conversion option  . . . . . PDFCVTOPT  *            1-4, *
Distribution type  . . . . . . . DSTTYPE    *BC          (0-2), *TO,
                                                         *CC, *BC
Sender's blank copy  . . . . . . SENDERCOPY *NO          *YES, *NO
FROMNAME: Name of the person sending these messages
FROMADDR: E-mail address of the person sending these messages
DTAQ: name and library of the data queue associated to one or more output queues
CVTPDF: type *YES if you want all the spooled files be converted to PDFs prior to be e-mailed.

  • Information about conversion of spooled files to PDF's is provided later in this page.
  • The spool_file_to_PDF conversion program used in this process is the utility selected through command MMAIL/CVTTOPDF.
  • Note 1- For additional parameters of command CVTSPLSTMF when spooled file conversion to PDF is requested, see Note on CVTSPLSTMF spooled file conversion to PDF.
    Note 2- If the conversion utility specified by command CVTTOPDF is CVTSPLSTMF (which handles only *SCS, *IPDS, *LINE, and *AFPDSLINE spooled files) and the spooled file type is *AFPDS, then utility CVTSPLFPDF (which handles both *SCS and *AFPDS spooled files) is used instead.
    Note 3- If the conversion utility specified by command CVTTOPDF is CVTSPLFPDF (which handles only *SCS and *AFPDF spooled files) and the spooled file type is *IPDS, *LINE, or *AFPDSLINE, then utility CVTSPLSTMF is used instead.
RMVSPLF: enter *YES to delete a spooled file once it has been e-mailed, enter *NO to retain it
DISP: enter *IMBED to embed the spooled file in the mail message body, or enter *ATTACH to attach the spooled file to the mail message
IMPORTNC: *LOW=low, *MED=medium, *HIG=high
PRIORITY: *NUR=non-urgent, *NRM=normal, *URG=urgent
SENSITIV: *NRM=normal, *PRS=personal, *PRV=private, *CNF=confidential (use command mmail/setconfid to set the confidentiality statement).
SPLFTIME: *JOBSTR to process only the spooled files generated in the output queue or moved to it since when the batch job was started;
*ANY to process also the spooled files generated or moved to the output queue before that the batch job was started.
SPLFSND: this is a list of up to 50 entries. Each entry is made of two elements, spooled file name and group name:
  1. spool file name: a string for selecting spool file names eligible for being e-mailed. It may contain a full file name (e.g. QSYSPRT), a generic name (e.g. QSYS*, or *ALL (all spooled files will be e-mailed).
  2. group name: name of the address group to which the selected spooled files should be e-mailed
SICONOPT. Use this option to insert an icon in front of the subject of the e-mail messages sent from this program.
If you specify *YES, the icon used will be the one associated to the spool file group.
  • A group icon can be selected when defining or updating a group via command MMAIL/WRKGRP (Work with groups).
  • The available icons are documented on this page.
CHKUSRDTA. In some cases, the user of this command would rather select the spooled file to be e-mailed from the contents of the spooled file user data rather than from the spooled file name. This can be done by specifying *YES in this last parameter. In such a case, spooled file user data (instead of spooled file names) are checked vs the selection strings of the previous parameter.
SBJTYPE. This parameter establishes the way the subject of the e-mail is captured from the spooled file.
  1. If type A (default value) specified, the subject is taken from the first line of the first page of the spooled file. If this line is empty, then type B subject is used.
  2. If type B, the subject is made up from date and time, the system name, the qualified output queue name and the spooled file name.
  3. If type C, the subject is searched in records of file MMAILDATA/EMLSPLFSBJ. If no match found, type A is used.
    Populating this file is up to the installer (a DFU or cgi_wrkdbf can be used).
    The record format of this file has the folllowing layout:
    1.char 10Output queue library
    2.char 10Output queue name
    3.char 10spooled file name
    4.char 10spooled file user data
    5.char 10spooled file number
    6.char 70Subject to be used
    Fields 1 to 5 are the search keys.
    Field number 4 may contain a specific user data value or *ANY as a wild card.
    Field number 5 may contain a spooled file number (example: 000002) or *ANY as a wild card.
PDFCVTOPT. This parameter can be specified only if CVTTOPDF(*YES).
It is used to override the name of the spool-file-to-PDF conversion tool selected from command CVTTOPDF.
Allowed values:
  • * - use the PDF conversion tool specified in command CVTTOPDF
  • 1 - use the CVTSPLSTMF freeware
  • 2 - use the CVTSPLFPDF freeware
  • 3 - use the AFPTOOL product
  • 4 - use the INFOPRINT product
The AFP TO PDF TRANSFORM FEATURE cannot be used with command STREMLSPLF as it does not generate spooled files.

DSTTYPE. This parameter establishes the type of addressee distribution.
Allowed values:

  • 0 or *TO: all addressees are in to: distribution
  • 1 or *CC: all addressees are in cc: distribution
  • 2 or *BC: all addressees are in bc: distribution

SENDERCOPY. Use this parameter to specify whether a blank copy of each message should be sent to the sender's e-mail address.

Note 1. Command MMAIL/STREMLSPLF submits a batch job.
Note 2. Only one MMAIL/STREMLSPLF command can be issued for a given data queue. If the job submitted for a given data queue is still active, no more MMAIL/STREMLSPLF commands for the same data queue are accepted. Use command MMAIL/ENDEMLSPLF DTAQ(...) to end the submitted job.
Note 3.The following log files are maintained in library MMAILDATA:

  1. EMLSPLFLOG - A record for each spooled file processed. Record layout:
    • timestamp
    • qualified name of the data queue
    • qualified name of the batch job processing spooled files
    • qualified name of the job that produced the spooled file
    • spooled file name
    • spooled file number
    • action performed by the program in charge for processing spooled files
    This file contains records for the last 7 days. Old records are removed when command STREMLSTMF is entered.
  2. SPLLOG - A record for each mail destination of messages sent. Record layout:
    • date
    • time
    • data queue library name
    • data queue name
    • output queue library name
    • output queue name
    • spooled file name
    • sent flag: Y=successful, N=failed
    • address group (distribution list)
    • addressee name
    • addressee e-mail address
    This file should be cleared now and then.





7a. Automated e-mailing of spooled files, Version 2

Command MMAIL/STREMLSPL2
is a slightly different version of command MMAIL/STREMLSPL1. Here are the differences:

  1. Command STREMLSPLF2 allows to have a message body common to all the automated e-mail messages. This message body is a stream file to be specifed in parameter BODY.
  2. In command STREMLSPL2 the distribution type (*TO, *CC or *BC) here is at the same level of "spooled file and group" (see command parameter SPLFSND), while in command STREMLSPLF the distribution type is a single value for all spooled files and groups.
It is worth to be noted that, at a given time, just one of these commands (STREMLSPLF and STREMLSPLF2) can be active on a given outq-dataq.
                   Start E-Mailing Spool Files (STREMLSPL2)

Type choices, press Enter.

'Sender's name'  . . . . . . . . FROMNAME                           
'Sender's e-mail address'  . . . FROMADDR                           
Common message body (stmf) . . . BODY       *NONE                   
Data queue . . . . . . . . . . . DTAQ                      Name
  Library  . . . . . . . . . . .              *LIBL        Name, *LIBL,
                                                           *CURLIB
Convert all spool files to PDF . CVTPDF     *YES          *NO, *YES
Remove e-mailed spool files  . . RMVSPLF    *YES          *YES, *NO
MIME message disposition . . . . DISP       *ATTACH       *IMBED,
                                                           *ATTACH
Importance . . . . . . . . . . . IMPORTNC   *MED          *LOW, *MED,
                                                           *HIG
Priority . . . . . . . . . . . . PRIORITY   *NRM          *NUR, *NRM,
                                                           *URG
Sensitivity  . . . . . . . . . . SENSITIV   *NRM          *NRM, *PRS,
                                                           *PRV, *CNF
Spooled files timing . . . . . . SPLFTIME   *JOBSTR       *JOBSTR, *ANY
Spool files and groups:          SPLFSND     
                                                          Name,
                                                           generic*
                                                                 
                                              *TO 
                          + for more values  
Subject icon option  . . . . . . SICONOPT   *YES          *YES, *NO
Select from User Data  . . . . . CHKUSRDTA  *NO           *NO, *YES
Subject type   . . . . . . . . . SBJTYPE    A             A, B, C
PDF conversion option  . . . . . PDFCVTOPT  *             1-4, *
Sender's blank copy  . . . . . . SENDERCOPY *NO           *YES, *NO
Command MMAIL/ENDEMLSPLF should be used to end the batch job submitted by command MMAIL/STREMLSPL2.




8. Automated e-mailing of PDFs

This utility works as follow:

  • You create some IFS directories
  • For each directory you define a distribution list
  • As soon as a PDF is created in one of such IFS directories, it is e-mailed to the appropriate distribution list.
  • The tool you create a PDF with is irrelevant: it could be your favorite spooled file conversion tool, Acrobat Distiller, the OS V6 AFP Transform Feature, ..., it does not matter as long as the stream file extension is PDF.

This is how you perform the set up:

  1. You must have an Audit Journal active on your system.
    To implement it:
    1. Logon to a green terminal with a user profile with special authority *AUDIT
    2. Enter the following commands
      CRTJRNRCV JRNRCV(QSYS/QAUDJRNRCV) AUT(*ALL)
      CRTJRN JRN(QSYS/QAUDJRN) JRNRCV(QSYS/QAUDJRNRCV) AUT(*ALL)
      CHGSYSVAL SYSVAL(QAUDCTL) VALUE(*AUDLVL)
      CHGSYSVAL SYSVAL(QAUDLVL) VALUE('*CREATE *DELETE *OBJMGT')
  2. Use command MMAIL/WRKADDR to define the e-mail addresses of your users
  3. Use command MMAIL/WRKGRP to define Groups of addresses (distribution lists)
  4. Create the IFS directories intended to contain PDFs to be e-mailed.
  5. Use command MMAIL/WRKEMLPDF to associate a directory to one or more distribution lists.

To start the PDF distribution "Automat", enter command MMAIL/STRMONIFS.

  • This command submits job STRMONIFS to subsystem QSYSWRK
  • The batch job
    • sets a trigger on physical file MMAILDATA/MONIFS
    • receives journal entries from the audit journal and creates records in file MMAILDATA/MONIFS
  • The trigger program receives control every time a new IFS object is created, checks the stream file directory and the stream file extension.
    If both appropriate, it e-mails the stream file to the due distribution list(s), then deletes the stream file.

To end the PDF distribution "Automat", enter command MMAIL/ENDMONIFS.

As a summary, when the setup is done, you just need to enter command MMAIL/STRMONIFS .

Note 1. The mail message is constructed as follow:

  • The subject is the PDF stream file name
  • The body is empty
  • The PDF is the only attachment.
The consequence of an empty body is the SPAM level of the message being raised by some points. In order to avoid this from happening, it is advisable to have the message body containing some header and/or footer. This can be done through commands MMAIL/EMLDFTBODY.

Note 2. Two logs are maintained from STRMONIFS:

  • Physical file MMAILDATA/PDFLOG. It contains a record for each addressee of a PDF-message e-mailed via STRMONIFS.
  • Physical file MMAILDATA/EMLPDFLOG. It contains a record for each PDF-message e-mailed via STRMONIFS.





9. Default message body for EML... commands

The following commands:

  • EMLSAVF
  • EMLSTMF
  • EMLSPL
  • EMLSPL2
  • STREMLSLF
  • STREMLSPL2
may be used to e-mail messages with an empty text followed by one or more attachments.
Messages with an empty text are subject to raise their SPAM levels and therefore undergo the risk of being routed to the garbage or to the spam folder instead of being routed to the incoming mail basket.
This is why some default text must alway be added by these commands, whenever the user does not provide any text.
Use command MMAIL/EMLDFTBODY to specify such a default text. This command lets you
  • create the IFS stream file containing the default text
  • enter the default text
  • display it.




10. E-mailing SMS messages

You may send a specifically-customized e-mail message to a SMS gateway to have it converted to a SMS message and sent to the desired mobile(s). See this page.



11. Resend failed MIME messages

If for any reason a MIME file fails to be sent, it remains in directory /mmail/temp and cannot be re-sent unless you are able to call the QTMMSENDMAIL API passing all the requested parameters.

Command MMAIL/RESEND provides a way to invoke the QTMMSENDMAIL API for resending failed messages. Of course, in the problem is with the Mail Server Framework (MSF) or with the Simple Mail Transfer Protocol (SMTP), the resend of messages may very well fail also.

Command MMAIL/RESEND
                       Re-send failed messages (RESEND)

Type choices, press Enter.

Stream file  . . . . . . . . . .   *ALL                                   

Enter path and name of a MIME stream file to be resent.
If you specify *ALL, all MIME stream files in directory "/mmail/temp" are resent.




12. Converting spooled files to PDF

MMAIL provides interfaces to a number of spooled-file-to-PDF conversion tools.
You may select your preferred conversion tool via command MMAIL/CVTTOPDF.
Once that is done, you may use any MMAIL/EMLSPL... command to e-mail spooled files automatically converted to PDFs with your preferred conversion tool.-

If the automated conversion of a spooled file to PDF via MMAIL/EMLSPL... commands does not meet your requirements, you may perform the spool conversion to PDF with a tool of your choice and, when the PDF stream file is available, e-mail it as attachment with MMAIL command EMLHTML2, EMLTXTSTMF, or SENDMIME.

Here is the list of the MMAIL conversion tools supported in the MMAIL/EML... commands for automated conversion to PDF:

  1. BUNDLED FREEWARES
    Two open-source freewares are bundled in MMAIL:
    1. Command mmail/cvtsplstmf
      allows to convert an *SCS, *IFPDS, *LINE or *AFPDSLINE spooled file to a stream file, type text, html, or pdf.
    2. Command mmail/cvtsplfpdf
      allows to convert both an *SCS and an *AFPDS spooled file to a stream file, type pdf.
      This command is available only from OS/400 release V5R1 on.
      This freeware is made of two libraries: TIFFLIB and HPT which are delivered with MMAIL and installed during MMAIL installation process. These libraries can also be downloaded from UZAEMON's Homepage.
    The above utilities must be taken "ASIS": no enhancements, no fixes can be requested. Their sources, however, are made available.
  2. CHARGED PRODUCTS
    The following products are supported by MMAIL MMAIL/EMLSPL... commands, but they are on charge and it is up to you to buy and to install them:
    1. IBM INFOPRINT SERVER for iSERIES (5722-IP1).
      This is a professional product for printing on iSeries. Among several other features, it includes the ability to convert spooled files to PDF under user specified controls.
      For information about Infoprint Server, see this page.
    2. AFPTOOL and SPLTOOL from BVSTools.
      • AFPTOOL is for *AFPDS spooled files
      • SPLTOOL is for *SCS spooled files.
      Both these products can be downloaded and run with a free temporary key. Worth to be tried if the MMAIL bundled conversion tools do not fit your needs.
  3. i5 OS AFP TO PDF TRANSFORM
    Starting with V6R1, i5 OS supports the automated transformation of *AFPDS spooled file data to PDF stream files. You do need to have LPO 5761-TS1 *BASE and option 1 installed in order to use this support, but they are included on the CDs that come with the OS. For further information, please check out this page.
    In order to transform spooled file data to PDF, you simply need to issue an override printer file before opening the printer file:
      OVRPRTF FILE(spool_file_name) DEVTYPE(*AFPDS) TOSTMF('pdf_path_and_name') WSCST(*PDF)
    The PDF stream file must not yet exist!!!
    The spooled file is not generated!!!
    In order to e-mail a PDF, you have several options:
    • Use command EMLSTMF or EMLSTMF2. They both allow to e-mail stream files.
    • Use command EMLSPL. This is more tricky: you must specify *PDF as spooled file number. Besides, the PDF must be in directory /mmail/pdf and have the same name as the spooled file name specified in the command. Example: /mmail/pdf/qpdsplib.pdf.
      Last, the PDF is deleted after having been sent.
    • You can use the Automated E-mailing of PDFs.
  4. Command MMAIL/CPYSPLFPDF (from V7r1 on)
    Starting with V7R1, if option 01 (AFP to PDF Transform) of the 57xx-TS1 product is installed, system command CPYSPLF allows to copy a *SCS or *AFPDS spooled file to a PDF stream file.
    This is more easily done through command MMAIL/CPYSPLFPDF.
    This is the cheapest and easiest solution, provided that you run at least V7R1.

Note 1
When, during the execution of an ...EML... command, a spooled file is to be converted to PDF before be attached to the e-mail message, this is done through subprocedure MimeSplPdf of service program mmail/sendmail. Subprocedure MimeSplPdf selects one of the above listed conversion tools according to what you specified with command mmail/cvttopdf:

                           MIME & Mail - CVTTOPDF                              

   Select the preferred program for spool file conversion to PDF
   (Press F1 to know about these programs)

   1. CVTSPLSTMF
   2. CVTSPLFPDF
   3. AFPTOOL / SPLTOOL
   4. INFOPRINT SERVER


   7. CPYSPLFPDF


   Type option, press Enter.
   ====>         
                                                                               
   F3/F12=End                                                                  
Figure 41- Command CVTTOPDF

Note 2
Instead of the above conversion tools, you may decide to use your favorite "spool to pdf converter". To do so, you must

  1. update program mmail/cvttopdf
  2. rework subprocedure MimeSplPdf in mmail/qrpglesrc member xxxmime
  3. recreate the service program and all programs through command mmail/compile



Spool-file-to-PDF conversion commands:
  1. Command MMAIL/CVTSPLSTMF
  2. Command MMAIL/CVTSPLFPDF
  3. Command AFPTOOL/AFPTOOL
  4. Command SPLTOOL/SPL2STMF
  5. IBM Infoprint Server
  6. Command MMAIL/CPYSPLFPDF
  7. Command MMAIL/SPLFTOPDF
 *scs   *afpds   *line   *afpdsline   *userascii   free/fee 
 cvtsplstmf  X - X X - free
 cvtsplfpdf  X X X X - free
 afptool  - X - - - fee
 spltool  X - - - - fee
 infoprint server  X X X X - fee
 cpysplfpdf  X X - - - free


  1. Command MMAIL/CVTSPLSTMF
  2. This command allows to convert an *SCS, *IFPDS, *LINE or *AFPDSLINE spooled file to a stream file. The stream file type can be
    • text
    • html
    • pdf
    MMAIL/CVTSPLSTMF
                  Copy spooled file to Stream File (CVTSPLSTMF)
    
    Type choices, press Enter.
    
    From spooled file name . . . . .   __________    Name
    To stream file name  . . . . . .   ____________________________
    To directory . . . . . . . . . .   ____________________________
    Job name . . . . . . . . . . . .   *_________    Name, *
      User . . . . . . . . . . . . .   __________    Name
      Number . . . . . . . . . . . .   ______        000000-999999
    Spooled file number  . . . . . .   ______        1-9999, *ONLY,
                                                     *LAST
    Stream file format . . . . . . .   *TEXT_        *TEXT, *HTML,
                                                     *PDF
    Stream file option . . . . . . .   *NONE___      *NONE, *ADD,
                                                     *REPLACE
    Additional parameters for stream file format *TEXT:
    Stream file code page  . . . . .   *PCASCII_     1-32767,
                                                     *PCASCII,
                                                     *STMF
    Additional parameters for stream file format *HTML:
    Title for HTML or PDF  . . . . .   *NONE__________________
    Stream file code page  . . . . .   *PCASCII_     1-32767,
                                                     *PCASCII,
                                                     *STMF
    Additional parameters for stream file format *PDF:
    Title for HTML or PDF  . . . . .   *NONE__________________
    Page size:
      Paper size . . . . . . . . . .   *SPLF__       *SPLF, 
                                                     *CUSTOM,
                                                     *A4, *A5...
      Orientation  . . . . . . . . .   __________    *LANDSCAPE,
                                                     *PORTRAIT
    Font:
      Face . . . . . . . . . . . . .   *CONVERT_     *CONVERT,
                                                     *COURIER...
      Size . . . . . . . . . . . . .   _____         4-36, *CALC
    Type of PDF bookmarks  . . . . .   *PAGNBR_      *PAGNBR,
                                                     *POS, *KEY,
                                                     *NONE
    Stream file code page  . . . . .   *PCASCII_     1-32767,
                                                     *PCASCII,
                                                     *STMF

    Note on ...EML... commands.
    See topic Spool-to-pdf conversion via ...EMLSPL... commands to learn how to pre-define the CVTSPLSTMF parameters, when command CVTSPLSTMF is implicitly used in e-mail commands for attaching spooled files converted to PDFs.


  • Command MMAIL/CVTSPLPDF
  • This command allows to convert a spooled file to a PDF stream file. The spooled file can be *SCS or *AFPDS.
    spooled files must not be greater than 16 Mb.
                    Convert spool file to pdf (CVTSPLFPDF)
    
    Type choices, press Enter.
    Spooled file name  . . . . . . .                Name
    PDF path and name  . . . . . . .                              
    Job name . . . . . . . . . . . .   *            Name, *
      User . . . . . . . . . . . . .                Name
      Number . . . . . . . . . . . .                 000000-999999
    Spooled file number  . . . . . .                 1-9999, *ONLY,
                                                      *LAST
    Replace PDF stream file  . . . .   *YES          *YES, *NO
    Other parameters are available to specify paper size, orientation, and margin.
    Note 1
    This command is based on a free software (libraries HPT and TIFFLIB) originated from Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Anyone using this software must know that it is available at no charge. To know more about copyrights, please read members COPYING and LICENSE in HPT/LICENSE.
    Note 2
    The conversion process is performed in two steps:
    • conversion of the spooled file to a .tif stream file (command hpt/spl2stmf)
    • conversion of the .tif stream file to a .pdf stream file (command tifflib/tiff2pdf)
    Note 3
    When running under OS/400 release V5R4 or subsequent, it is suggested to invoke command CVTSPLFPDF from a user profile specifying LOCALE(*NONE).

    Note on ...EML... commands.
    See topic Spool-to-pdf conversion via ...EMLSPL... commands to learn how to pre-define the CVTSPLFPDF parameters, when command CVTTOSTMF is implicitly used in e-mail commands for attaching spooled files converted to PDFs.


  • Command AFPTOOL/AFPTOOL
  • This command allows to convert an *AFPDS spooled file to a PDF stream file.
    AFPTOOL/AFPTOOL
                        Convert AFP to PDF (AFPTOOL)
    
    Type choices, press Enter.
    
    Spooled file name  . . . . . . .                 Name
    Job name . . . . . . . . . . . .   *             Name, *
      User . . . . . . . . . . . . .                 Name
      Number . . . . . . . . . . . .                 000000-999999
    Spooled file number  . . . . . .                 1-9999, *ONLY,
                                                    *LAST
    Output stream file . . . . . . .                               
                               Additional Parameters
    Replace object . . . . . . . . .   *NO           *YES, *NO
    Manufacturer type and model  . .   *WSCST        
    WSCST Name . . . . . . . . . . .   QWPTIFFG4     Character value,
                                                    *NONE
    WSCST Library  . . . . . . . . .   QSYS          Character value,
                                                    *LIBL
    Temp path  . . . . . . . . . . .   '/tmp'                      
    Page rotation  . . . . . . . . .   0             0, 90, 180,
                                                    270
    Margin offset  . . . . . . . . .   20            Number
    Left margin offset . . . . . . .   0             Number
    Top margin offset  . . . . . . .   0             Number
    Note 1 - This command requires library QFNTCPL (AFP Compatibility Fonts, product 5722SS1, option 8, feature 5050).
    Note 2 - Both libraries AFPTOOL and QFNTPCL must be added to the job library list.

    Note on AFPTOOL *AFPDS spooled file conversion to PDF
      Command afptool is implicitly executed when one of the following commands asks for *AFPDS spooled file conversion to PDF: or when one of the following subprocedures is executed
    • MimeSplPdf
    • SplPdf
    and option 3 (AFPTOOL / SPLTOOL) was specified in command CvtToPdf.



  • Command SPLTOOL/SPL2STMF
  • This command allows to convert a *SCS spooled file to a PDF stream file.
    AFPTOOL/SPL2STMF
                               Spooled File To Stream File (SPL2STMF)
    
    Type choices, press Enter.
    
     Spooled file . . . . . . . . . .                 Name                          
     Job Name . . . . . . . . . . . .                 Name, *                       
       User . . . . . . . . . . . . .                 Name                          
       Number . . . . . . . . . . . .                 000000-999999                 
     Spooled file number  . . . . . .                 1 - 999999, *ONLY, *LAST      
     Job System Name  . . . . . . . .   *ONLY         Character value, *ONLY...     
     Creation date (MMDDYYYY) . . . .   *ONLY         Character value, *LAST, *ONLY 
     Creation time (HHMMSS):  . . . .   *ONLY         Character value, *LAST, *ONLY 
     From page  . . . . . . . . . . .                 1-999999, *FIRST, *LAST       
     To page  . . . . . . . . . . . .                 1-999999, *FIRST, *LAST       
     Stream file  . . . . . . . . . .                                                   
                                                                                        
                                                                                        
                                                            
     Directory  . . . . . . . . . . .                                                   
                                                                                        
                                                                                        
                                                            
     PDF Overlay  . . . . . . . . . .   *NONE                                           
                                                                                        
                                                                                        
                                                            
     Overlay Position . . . . . . . .   *BOT          *BOT, *TOP                    
     Concatenate PDF  . . . . . . . .                                                   
                                                                                        
                                                                                        
                                                            
     Merge Spooled Files  . . . . . .   *NO           *FIRST, *LAST, *YES, *NO      
     Create directory . . . . . . . .   *NO           *YES, *NO                     
     Public authority for data  . . .   *INDIR        *INDIR, *RWX, *RW, *RX...
     Public authority for object  . .   *INDIR        *INDIR, *NONE, *ALL...        
     Replace file . . . . . . . . . .   *NO           *YES, *NO, *ADD               
     Stream file code page  . . . . .   437           1-32767                       
     Include blank pages  . . . . . .   *YES          *YES, *NO                     
     HTML Title . . . . . . . . . . .                                                   
                                                                                        
             
     Line selection . . . . . . . . .                                                   
                                                                                        
                                                                                        
                                                                                   ...
    
                                       Additional Parameters
    
     PDF Password . . . . . . . . . .                                        
     PDF Font . . . . . . . . . . . .   *COURIER                                    
     Manufacturer type and model  . .   *WSCST                               
     WSCST Name . . . . . . . . . . .   QWPTIFFG4     Character value, *NONE 
     WSCST Library  . . . . . . . . .   QSYS          Character value, *LIBL 
     Page width . . . . . . . . . . .   8.5           Number                 
     Page length  . . . . . . . . . .   11            Number                 
     Page rotation  . . . . . . . . .   0             0, 90, 180, 270        
     Margin offset  . . . . . . . . .   20            Number                 
     Left margin offset . . . . . . .   0             Number                 
     Top margin offset  . . . . . . .   0             Number
    Note 1 - Library SPLTOOL must be added to the job library list.

    Note on SPLTOOL *SCS spooled file conversion to PDF
      Command spltool/spl2stmf is implicitly executed when one of the following commands asks for *SCS spooled file conversion to PDF: or when one of the following subprocedures is executed
    • MimeSplPdf
    • SplPdf
    and option 3 (AFPTOOL / SPLTOOL) was specified in command CvtToPdf.



  • IBM Infoprint Server for iSeries (5722-IP1)
  • This product needs no commands. It would convert to PDF any spooled file created or moved to a given output queue.
    To use this product within MMAIL:
    1. set up the environment needed by Infoprint Server by using command MMAIL/INFOPRINT
    2. use command MMAIL/CVTTOPDF to select it as the favorite conversion tool
    3. any time you ask the MMAIL/SENDMAIL service program to e-mail a spooled file after converting it to PDF, the spooled file will be moved to the INFOPRINT output queue, get converted to PDF, attached to your MIME message and e-mailed.
      For information about Infoprint Server, see this page.
    Note on Infoprint Server spooled file conversion to PDF
      Infoprint Server spooled file conversion procedure is implicitly executed when one of the following commands asks for spooled file conversion to PDF: or when one of the following subprocedures is executed
    • MimeSplPdf
    • SplPdf
    and option 4 (Infoprint Server) was specified in command CvtToPdf.



  • Command MMAIL/CPYSPLFPDF
  • Starting with V7R1, if option 01 (AFP to PDF Transform) of the 57xx-TS1 product is installed, system command CPYSPLF allows to copy a *SCS or *AFPDS spooled file to a PDF stream file.
    This is more easily done through command MMAIL/CPYSPLFPDF:
                         Cpy a spool file to a PDF stmf (CPYSPLFPDF)
    
    Type choices, press Enter.
    
     Spooled file . . . . . . . . . .                 Name                         
     Job name . . . . . . . . . . . .   *CURRENT      Name, *CURRENT               
       User . . . . . . . . . . . . .                 Name                         
       Number . . . . . . . . . . . .                 000000-999999                
     Spooled file number  . . . . . .   *LAST         1-999999, *ONLY, *LAST, *ANY 
     To PDF stream file path  . . . .                                 
           


  • Command MMAIL/SPLFTOPDF
  • This command converts a spooled file to PDF using your favorite conversion tool, as per command CvtToPdf.
                     Convert spool file to pdf (SPLFTOPDF)
    
    Type choices, press Enter.
    
     Spooled file name  . . . . . . .                 Name
     Job name . . . . . . . . . . . .   *             Name, *
       User name  . . . . . . . . . .                 Name
       Job number . . . . . . . . . .                 000000-999999,
     Spooled file number  . . . . . .   *LAST         1-999999, 
                                                     *ONLY, *LAST
     PDF path and name  . . . . . . .                                 
           


  • Spool-to-pdf conversion via ...EMLSPL... commands
  • The following commands, used to e-mail spool files,

    1. EMLSPL (E-Mail spooled files)
    2. EMLSPLX (E-Mail spooled files)
    3. EMLSPL2 (E-Mail spooled files)
    4. SENDMIME (Send a MIME message)
    5. STREMLSPLF (Start E-Mailing spooled files)
    6. STREMLSPL2 (Start E-Mailing spooled files)
    may, if requested, convert to PDF the spooled file(s) to be sent.
    They select the spool-to-pdf conversion tool among the available ones (CVTSPLSTMF, CVTSPLFPDF, AFPTOOL / SPLTOOL, INFOPRINT) according to what specified by command CVTTOPDF.

    In some cases, there is a need to provide these utilies (CVTSPLSTMF, CVTSPLFPDF, AFPTOOL/SPLTOOL, INFOPRINT) with appropriate command parameters, in order to obtain the desired PDF layout. However these commands do not allow for any input parameters defining the desired PDF layout. This is because the utility to be used is established during command processing by service program subprocedure ("mimeSplPdf"), which picks up the spool-to-pdf conversion utility according to what was specified in command CVTTOPDF.

    This is why you need to pre-define the PDF parameters, before an ...EMLSPL... command is executed.

    A number of commands are available to create pre-defined parameters sets for the spool-to-pdf conversion utilities. These pre-defined parameters set are retrieve by MMAIL/SENDMAIL subprocedure MimeSplPdf (which is used to attach a spooled file to an e-mail message after converting it to PDF). As a consequence, these pre-defined parameters are implicitely used by any program calling subprocedure MimeSplPdf, that is by

    • the 6 ...EMLSPL... commands previously listed
    • any other user program invoking subprocedure MimeSplPdf.

    The following is a list of the commands available for creating pre-defined parameters sets:

    1. Command SPLPDFCVT (SPL-to-PDF conversion param.s)
      This command allows to pre-define parameter sets for spool-to-pdf conversion tools CVTSPLSTMF and CVTSPLFPDF.
      Pre-defined parameters sets are identified by
      1. spool_file_name AND
      2. spool_file_user_data
    2. Command SETSPLSTMF (Set parameters for command CVTSPLSTMF )
      This command allows to pre-define a single parameters set for ALL the spooled files converted by tool CVTSPLSTMF in the same job issuing this command.
      This predefined parameter set is available to:
      • all the six e-mail commands (EMLSPL, ..., STREMLSPL2) listed at the beginning of this topic.
      • any other user program invoking subprocedure MimeSplPdf.
        NOTE- When for a given spooled file pre-defined parameters sets are available also from command SPLPDFCVT and from command SETSPLSTMF, the ones from command SPLPDFCVT are taken.
      • command CVTSPLSTMF
      • command SPLTOPDF when the spool-to-pdf conversion tool specified in command CVTTOPDF is CVTSPLSTMF.
        Command SPLTOPDF does not perform any e-mail activity by itself.
    3. Command SETSPLFPDF (Set parameters for command CVTSPLFPDF)
      This command allows to pre-define a single parameters set for ALL the spooled files converted by tool CVTSPLFPDF in the same job issuing this command.
      This predefined parameter set is available to:
      • all the six e-mail commands (EMLSPL, ..., STREMLSPL2) listed at the beginning of this topic.
      • any other user program invoking subprocedure MimeSplPdf.
        NOTE- When for a given spooled file pre-defined parameters sets are available also from command SPLPDFCVT and from command SETSPLFPDF, the ones from command SPLPDFCVT are taken.
      • command CVTSPLFPDF
      • command SPLTOPDF when the spool-to-pdf conversion tool specified in command CVTTOPDF is CVTSPLFPDF.
        Command SPLTOPDF does not perform any e-mail activity by itself.
    4. Command SETAFPTOOL (Set parameters for command AFPTOOL/AFPTOOL)
      This command allows to pre-define a parameters set for a given name of spooled file (example: QPDSPLIB) to be converted by command AFPTOOL/AFPTOOL.
      This predefined parameter set is available to all the six e-mail commands (EMLSPL, ..., STREMLSPL2) when requested to convert to PDF a spooled file named in this way (example: QPDSPLIB).
    5. Command SETSPLTOOL (Set parameters for command SPLTOOL/SPL2STMF)
      This command allows to pre-define a parameters set for a given name of spooled file (example: QPDSPLIB) to be converted by command SPLTOOL/SPL2STMF.
      This predefined parameter set is available to all the six e-mail commands (EMLSPL, ..., STREMLSPL2) when requested to convert to PDF a spooled file named in this way (example: QPDSPLIB).





    13. Converting spooled files to PC documents

    In some cases you may want to convert a spooled file to a PC document.
    MMAIL provides a command to do that, though the result may have problems in fitting the available paper sizes.
    This command, however, could be a temporary solution if your System i produces *SCS DBCS spooled files.
    PC documents can be e-mailed as attachments via command EMLSTMF or EMLSTMF2.

    The command that convert a spooled file to a PC document is named SPLFTOPCD and looks as follow:

                              Copy spool file to PC doc (SPLFTOPCD)
                                                                                    
     Type choices, press Enter.                                                     
                                                                                    
     Spooled file . . . . . . . . . . SPLF                   Name
       Job name . . . . . . . . . . .          *CURRENT      Name, *CURRENT
         job user . . . . . . . . . .                        Name
         job number . . . . . . . . .                        000000-999999
       Spooled file number  . . . . .          *LAST         1-999999, *ONLY, *LAST 
     To PC Doc. stream file . . . . . TOSTMF                                                   
          
     Stream file option . . . . . . . STMFOPT  *NONE         *NONE, *REPLACE               
     Translate table  . . . . . . . . TRNTBL   *DFT          Name, *DFT, *NONE             
       Library  . . . . . . . . . . .            *LIBL       Name, *LIBL, *CURLIB          
     Format of PC data  . . . . . . . TRNFMT     *TEXT       *TEXT, *NOTEXT                
     DBCS code page . . . . . . . . . TRNIGC    *DFT         *DFT, *JPN, *CHT, *BG5...     
    


    Use this command to copy a spool file to a PC document (a PC file with extension .doc ).
    The PC document will be generated in a /QDLS folder and copied to the stream file specified in the TOFILE parameter. You may then e-mail this stream file via MMAIL command EMLSTMF or EMLSTMF2.
    Note 1: This command may help when the spooled file is a *SCS DBCS one and you are missing tools to convert it to a PDF stream file.
    Note 2: The user profile running this command must be enrolled in the system distribution directory (command WRKDIRE).
    Command parameters:

    • Spooled file (SPLF) - The spooled file that you want to convert to a PC document. It must be type *SCS.
    • To PC Doc. stream file (TOSTMF) - Path and name of the IFS stream file that should receive the generated PC document.
      Example: '/tmp/myfile.doc' .
      The stream file does not have to already exist. If it does, then you must specify STMFOPT(*REPLACE).
      Note 3: The stream file will be generated with a CCSID compatible with PC data standards.
    • Stream file option (STMFOPT) - Specifies the action to be taken if the stream file from prompt TOSTMF exists already.
      • *NONE - If the stream file already exists, the command will fail.
      • *REPLACE - If the stream file already exists, it will be deleted and created from new.
    • Translate table (TRNTBL) - Specifies if translation is performed and, if so, the name of the translation table used to translate the spooled file data from EBCDIC to ASCII
      . Note 4: For a user defined double-byte character set, this parameter also specifies if translation is performed and, if so, which translation table is used for single-byte translation.
      The format of the data records in the PC document is handled by the format of PC data prompt (TRNFMT parameter).
      • *DFT - The default translation table is used.
      • translation-table-name - Specify the name and library of the translation table. The possible library values are:
        • *LIBL - The library list is used to locate the table.
        • *CURLIB - The current library for the job is used to locate the table. If no current library entry exists in the list, QGPL is used.
        • library-name - Specify the library where the table is located.
      • *NONE - No translation from EBCDIC to ASCII is performed. The data records are copied to the PC document as fixed-length records. There are no are no ASCII carriage return, line feed, or end of file characters added to the PC document. The length of these fixed records is the same as the length of the records in the spooled file.
    • Format of PC data (TRNFMT) - Specifies the format the data records in the PC document are to have. This parameter is not valid if *NONE is specified on the translate table prompt (TRNTBL parameter).
      • *TEXT - The data records in the PC document will be written in standard DOS ASCII variable length format. The ASCII carriage return and line feed characters are added to the end of each record, and the ASCII end of file character is added to the end of the PC document.
      • *NOTEXT - The data records in the PC document will be fixed length records. The length of the records in the spooled file is used for the length of the records in the PC document.
    • DBCS code page (TRNIGC) - Specifies the double-byte character set used for translation. Unless overridden by the translate table prompt (TRNTBL) parameter, this parameter also specifies the single-byte translation table.
      • *DFT - The default country or region's double-byte character set.
      • *JPN - IBM Japanese.
      • *CHT - IBM Traditional Chinese.
      • *BG5 - Taiwan Industry standard (BIG-5).
      • *CHS - IBM Simplified Chinese.
      • *KOR - IBM Korean (KS).
      • *KSC - Korean Industry standard.
      • *SCGS - The People's Republic of China National standard (GB).
      • *NONE - No double-byte translation is performed.





    14. Logging outbound e-mail messages

    A requirement common to many companies is that of maintaining a log of the outbound e-mail messages.

    MMAIL provides you with a way to do it.

    The MMAIL SENDMAIL service program provides an exit point - named SENDMAIL-002 - to call your user-program intended to perform the logging.
    To use this exit point:

    1. Run command MMAIL/UPDEXITP:

                        Update MMAIL Exit Points
      
       Type option, press Enter.
         2=Change
      
         Exit point               User program
         SENDMAIL-001
       2 SENDMAIL-002
       
       
                                                              Bottom 
       F3=End

    2. Select with a 2 the SENDMAIL-002 enntry, then on the next screen specify the name of your log user-program:
                        Update MMAIL Exit Points
                                                                     
       Exit point . . . . . . . . SENDMAIL-002
       User program . . . . . . . MYLOGPGM  
         Library  . . . . . . . .   MYLIB     
      
       F3=End  F12=Cancel

    Here is the parameter list passed to your log user-program:
    Timestamp of the eventZ
    Event status code10I0
    E-mail subject70A
    Sender's e-mail address255A
    Number of entries in the next two arrays10U0
    Array of addressee e-mail addresses256Adim(1000)
    Array of delivery codes10I0dim(1000)
    Path and name of the saved message stream file266A
    where

    • Event status code - Possible values are:
      0E-mail message successfully submitted to MSF
      -1API QTMMSENDMAIL failed to submit the e-mail message to MSF
      -2Sender's e-mail address not valid. Message was not sent.
      -3At least one recipient address not valid. Message was not sent.
      -4No valid recipient addresses. Message was not sent.
      -5Message blocked by message-validation exit point user program.
    • Array of delivery codes - Delivery code possible values:
      0*TO
      1*CC
      2*BC

    MMAIL includes an example of such a logging program:

    • Its name is MMAIL/LOGOUTMAIL
    • It writes log entries to database file MMAILDATA/OUTMAILLOG.





    15. Archiving outbound e-mail messages

    Maintaining a log file of the outbound e-mail messages may not be enough. In some circumstances you may need to check the contents of an e-mail message sent days before and you may even need to resend it.

    Our suggestion is to use one of the following two solutions:

    1. Easy archive
      The easy solution is to ask the MMAIL mail-sending function to send a blank copy of each message to a given number (at least one) of e-mail addresses ("blind receivers"). These blind receivers could then act as mail archives and they can take advantage of all the features provided by client e-mailers for sorting, searching, and displaying e-mail messages.
      This can be obtained very easily:
      1. A data area (MMAILDATA/MDTBC) is used to enable / disable the blank copy feature.
      2. A database file (MMAILDATA/MDTBC) is used to maintain the e-mail addresses of the blind receivers.
      Command MMAIL/WRKMDTBC (see the next figure) must be used to properly set the data area and to maintain the database file:

      Command WRKMDTBC (Work with mandatory blank copies)

    2. Archive on your IBM i
      You may maintain a temporary archive of the outgoing e-mail messages on some IFS directory of your IBM i.
      You do that through command MMAIL/SETSAVOPT:

                     Outgoing mail save options (SETSAVOPT)
      
      Type choices, press Enter.
      
       Status . . . . . . . . . . . . . STATUS   *ON         *ON, *OFF
       Purge after days . . . . . . . . PURGE    14          1-999, *NEVER

      Use this command to specify the save options for the outgoing e-mail message stream files.

      • The names of the saved message files have format Qnnnnn.txt (where nnnnn is a unique numeric identifier) and are saved saved into the /amailer subdirectory associated to AMAILER account DSPOUTLOG.

      STATUS - Status of saving process. Select

      • *ON to enable the save of the stream message files of the outgoing e-mail messages.
      • *OFF to disable such a save.
      PURGE - Number of days after which a saved outbound e-mail message stream file should be deleted. If *NEVER specified, no purging is performed.
      Note 1 - When SETSAVOPT STATUS(*ON), every time a new e-mail message is sent, the MMAIL e-mail sending procedure SendMail() performs the purging of the expired e-mail message stream files.
      Note 2 - Saved outbound e-mail message stream files are documented in database file MMAILDATA/OUTMSGLOG.
      Note 3 - The mail message archiving process is carried out by a batch job, named MAILARCHIV, which is automatically submitted - if needed - to subsystem QSYSWRK. This job may be ended at any time. If no longer active, it will re-submitted as soon as a new MMAIL outgoing message is generated.





    17. Displaying the log of outbound e-mail messages

    If you

    1. did enable the logging of the outbound e-mail messages through command UPDEXITP (see Logging outbound e-mail messages) by specifying the MMAIL logging program MMAIL/LOGOUTMAIL
    2. are maintaining a temporary archive of the outgoing e-mail messages through command SETSAVOPT (see Archiving outbound e-mail messages)
    3. installed and started the HTTP instance MMAIL as per the comments in its configuration file
      (run command DSPF '/mmail/conf/httpd.conf' )
    then you can display the log of outbound e-mail messages from your Internet browser by typing the URL
    http://your_IP_address:8035/mmailp/dspoutlog.pgm
    Each log entry documents
    • date and time
    • status code (0=submitted to MSF, -1=bad sender e-mail address, -2=at least one bad receiver e-mail address)
    • subject
    • distribution
    of an archived outgoing e-mail message.
    By clicking the subject, you can even display the message and its attachments.

    For more information about the MMAIL message log display facility, see page Mail Log Display.




    17. Manage spooled files

    Some MMAIL users have raised the requirement to have a command similar to WRKSPLF, but also able to:

    • e-mail a selected spooled file
    • convert a spooled file to a stream file, either as a TEXT file (.TXT), or an HTML file (.HTML) or a PDF file (.PDF).
    That has been implemented through command mmail/mngsplf (Manage spooled files). This command (when prompted) allows more granular selection of spooled files than the OS/400 WRKSPLF command, and fulfills the requested conversion types.
    This command takes advantage of these other following commands:
    1. mmail/emlspl, to e-mail a spooled file (after optionally converting it to a PDF)
    2. mmail/cvtsplstmf, to convert a spooled file to a text or to an html stream file
    3. mmail/splftopdf, to convert a spooled file to a pdf stream file, using the preferred conversion tool selected through command cvttopdf
    Figure 1 - Command MNGSPLF
    The following special options are supported:
    • A - Convert a spooled file to TEXT and e-mail it to an e-mail address associated to the job user profile (see Note 1 and Note 2 below).
    • B - Convert a spooled file to PDF and e-mail it to an e-mail address associated to the job user profile (see Note 2 below).
    • C - Convert a spooled file to a .TXT stream file in the job user profile IFS home directory (see Note 1 below).
    • D - Convert a spooled file to a .PDF in the job user profile IFS home directory.
    Note 1 - Only *SCS spooled files can be converted to .TXT stream files).
    Note 2 - Options A and B retrieve
    • the default sender's name from the System Directory (command WRKDIRE) for the current user profile
    • the default sender's e-mail address from the System Directory (command WRKDIRE + F19) for the current user profile
    • the default addressee name from the System Directory (command WRKDIRE) for the current user profile (the same as the default sender's name)
    • the default addressee e-mail address from file MMAILDATA/USREMAIL (maintained with command mmail/wrkusreml) for the current user profile.





    18. Spooled Files Actions

    System i release 6.1 added the option of customizing various spooled file panels with your own list actions. This new facility (see this IBM i Infocenter page) allows you to perform commands and actions in an exit program against one or more spooled files shown in the list panels displayed when running any of the following system commands:

    • Work with Printer Output (WRKSPLF ASTLVL(*BASIC))
    • Work with Spooled Files (WRKSPLF ASTLVL(*INTERMED))
    • Work with Job Spooled Files (WRKJOB OPTION(*SPLF))
    • Work with Output Queue (WRKOUTQ Output queue name)
    • Work with Spooled File Status (WRKSPLF DSPFMT(*S36FMT))
    Carsten Flensburg in SystemINetwork article Customizing Spooled File Panels with Spooled File Actions explains how this can be done and provides some sample code.
    We went through that code and decided to implement the same options already available for command mmail/mngsplf:
    • A - Convert a spooled file to TEXT and e-mail it to an e-mail address associated to the job user profile (see Note 1 and Note 2 below).
    • B - Convert a spooled file to PDF and e-mail it to an e-mail address associated to the job user profile (see Note 2 below).
    • C - Convert a spooled file to a .TXT stream file in the job user profile IFS home directory (see Note 1 below).
    • D - Convert a spooled file to a .PDF in the job user profile IFS home directory.
    Note 1 - Only *SCS spooled files can be converted to .TXT stream files.
    Note 2 - Options A and B retrieve
    • the default sender's name from the System Directory (command WRKDIRE) for the current user profile
    • the default sender's e-mail address from the System Directory (command WRKDIRE + F19) for the current user profile
    • the default addressee name from the System Directory (command WRKDIRE) for the current user profile (the same as the default sender's name)
    • the default addressee e-mail address from file MMAILDATA/USREMAIL (maintained with command mmail/wrkusreml) for the current user profile.

    Please note that options A, B, C and D will never show on the above system command screens.

    Installation

    • The programs not requiring V6R1 are created during MMAIL installation
    • The programs requiring V6R1 are created during MMAIL installation if the OS realease is at least V6R1. If the system is not yet at release V6R1, is up to you - as soon as the system is upgraded to V6R1 or to a subsequent release - to create these release dependent programs by running command mmail/CrtSplfAct.

    Enablement

    • You must make sure that Spooled File Actions A, B, C and D are not yet installed. Use command mmail/wrkSplfAct to check that out (this command also allows to remove installed options, should you need it).
    • Use command mmail/enbSplfAct to install the MMAIL Spooled File Actions A, B, C and D.





    19. Convert a stream file

    Sometimes there is a need to convert a stream file to another CCSID.
    Command MMAIL/STMFCVT is a convenient tool for this, provided that the stream file size does not exceed 16 megabytes.

                              Convert a stream file (STMFCVT)
    
     Type choices, press Enter.
    
     Source stream file . . . . . . . SRCSTMF                                
         
     Target stream file . . . . . . . TGTSTMF                                
         
     Target CCSID . . . . . . . . . . TGTCCSID  819      Number, *JOB,
                                                        *ASCII...
     Display target stream file . . . DSPTGT    *NO      *YES, *NO

    • In parameter SRCSTMF specify the qualified name of the original (source) stream file to be converted.
      Note: The CCSID of this stream file does not have to be specified.
    • In parameter TGTSTMF specify the qualified name of the converted (target) stream file.
      Note: If the TGTSTMF and the SRCSTMF stream files are the same stream file, or if TGTSTMF(*SRCSTMF), the original (source) stream file is replaced by the converted one.
      Note: If the TGTSTMF stream file exists already, it is replaced by the converted one.
    • In parameter TGTCCSID specify the CCSID to be assigned to the converted stream file. The CCSID could be a number between 1 and (65535-1) or one of the following special values:
      • *JOB means the job CCSID (or the job default CCSID if the job CCSID is 65535)
      • *ASCII (CCSID 819)
      • *UTF8 (CCSID 1208, UTF-8 Unicode)
      • *UTF16 (CCSID 1200, UTF-16 Unicode)
      • *UCS2 (CCSID 13488, UCS-2 Unicode)
    • In parameter DSPTGT specify whether you would like the converted stream file be displayed.





    20. WEB utilities

    Since a number of years, some interesting utilities have been made available for the WEB user. They allow to control spooled files and spool writers from a remote browser via HTTP. Functions like spooled file e-mailing, conversion to stream file or to PDF are also supported.

    In order to work, these utilities require some directives be added to the HTTP configuration (see later).

    Two utilities are currently available:

    1. WRKSPLF (Work with spooled files)
    2. WRKWTR (Work with printer writers)


    16a. WRKSPLF

    This utility is invoked through the URL
    http://.../mmailp/wrksplf.pgm

    It is very similar to the 5250 MNGSPLF utility, though more flexible.

    An initial screen (see Figure 2) allows to specify selection criteria for the spooled files:
    Figure 2 - Starting WRKSPLF
    Multiple selection criteria are handled in an "AND" condition.
    Please note the ability to specify even the number of lines per page.

    When *ALL output queues selected, the WEB page looks like that in Figure 3:
    Figure 3 - Working with all spooled files

    On the other side, when in Figure 2 a given output queue is specified, the WEB page also carries controls for that output queue:
    Figure 4 - Working with an output queue

    About the spooled file controls (buttons).

    • The Hold, Release, and Delete buttons can process multiple spooled files (for instance, you may delete five spooled files in a single shot).
    • The other buttons (Change (change spooled file attributes), Display (display a spooled file), Attributes (display spooled file attributes), E-mail (e-mail a spooled file), Cvt to Stmf (convert a spooled file to a stream file), and Cvt to Pdf (convert a spooled file to a PDF stream file)) process a single spooled file at a time and provide separate prompts in a new window for each function.
    About spool writers.
    Button Work with all printers switches to the WRKWTR WEB utility (see next).

    16b. WRKWTR

    This utility is invoked through the URL
    http://.../mmailp/wrkwtr.pgm
    or it may get control from the WRKSPLF utility.

    This utility is the WEB version of the WRKWTR 5250 command.
    It provides the status of all writers in a single page (see Figure 6).

    Figure 6 - Working with writers

    About the writers controls (buttons).

    • The Hold, End, and Release buttons may operate on multiple writers (for instance, you may end several writers in one shot).
    • Other buttons (Start (start a writer), Change (change the properties of a writer), and Messages (work with unanswered writer messages)), process a writer at a time by providing control pages in separate windows. See the example of the Messages button in Figure 6.
      Figure 6 - Working with writer unanswered messages

      Switching to spooled files control. There are two ways you may switch from the page in Figure 5 to the WRKSPLF utility.

      • By selecting a writer and pushing the button wrkoutq, you will go to a page like that in Figure 4.
      • By clicking button work with all spool files, you will go to the page in Figure 2.


      16c. HTTP directives

      When you install MMAIL, the installation procedure would suggest the installation of some HTTP directives for MMAIL. Such directives allow to display the WEB manual (THIS manual) and to run the WEB utilities.

      However, ih this is not your first MMAIL installation, and you already installed the MMAIL HTTP directives, you may not want to do that again.
      In such a case, you may want to check your MMAIL existing HTTP directives in your system, and the ones documented here, and add the missing ones. By doing do, you will enable the MMAIL WEB utilities for appropriate execution.

      The are two cases.

      1. If you are running an OS/400 release before V5R2, you must run the Original HTTP server (V5R1 Apache HTTP server is not recommended). In this case, please check the "MMAIL Original HTTP Directives". That may also be true if you are running OS/400 V5R2 still with the Original HTTP server.
      2. If you are running the Apache HTTP server (optional on V5R2, mandatory from V5R3 on), please check the "MMAIL Apache HTTP Directives".

      1 - MMAIL Original HTTP Directives
      #==== MMAIL, MIME & MAIL ==============================  
      Protection MMAILPR  {
            ACLOverride Off
            PostMask All
            GetMask All
            AuthType Basic
            ServerID "MIME & MAIL"
            PasswdFile %%SYSTEM%%
            UserID %%CLIENT%%
      }                                                        
      Protect /mmailp/* MMAILPR
      Map  /mmstart   /mmail/html/intro.htm
      Map  /mmailh/* /mmail/html/*
      Map  /mmailp/*.cgi  /mmailp/*.pgm
      Pass /mmail/*
      Exec /mmailp/* /QSYS.LIB/MMAIL.LIB/*  %%EBCDIC%%
      To change / add directives
      • enter command WRKHTTPCFG CFG(xxx), where xxx is the name of the appropriate HTTP instance (usually "CONFIG" for HTTP instance DEFAULT)
      • restart that HTTP instance

      2 - MMAIL Apache HTTP Directives
      #----        MMAIL directives
      AliasMatch /mmailh/(.*)  /mmail/html/$1
      AliasMatch ^/mmstart$ /mmail/html/intro.htm
      Alias /mmail/    /mmail/
      ScriptAliasMatch /mmailp/(.*).pgm /qsys.lib/mmail.lib/$1.pgm
      ScriptAliasMatch /mmailp/(.*).cgi /qsys.lib/mmail.lib/$1.pgm
      <Directory /mmail>
         AllowOverride None
         Options None
         order allow,deny
         allow from all
      </Directory>
      <Directory /QSYS.LIB/MMAIL.LIB>
         Options +ExecCGI
         CgiConvMode %%EBCDIC/EBCDIC%%
         AllowOverride None
         Options None
         order allow,deny
         allow from all
      </Directory>
      <LocationMatch /mmailp/(.*)>
         AuthType Basic
         AuthName "MIME & MAIL"
         PasswdFile %%SYSTEM%%
         UserID %%CLIENT%%
         Require valid-user
      </LocationMatch>
    To change / add directives
    • enter command STRPDM option 3 over file QUSRSYS/QATMHINSTC
    • display the member with the same name as the HTTP instance you want to update
    • there is a single record there; make up the name of the IFS stream file containing the configuration directives
    • use command EDTF on that stream file to perform HTTP directives maintenance
    • restart that HTTP instance





    21. Logging program messages

    When some MMAIL process does not provide the expected result, or is abnormally terminated, you may decide to investigate the joblog.

    In doing this you may face some major difficulties:

    • The granularity of the message logging is not high enough
    • The joblog is too big
    • The joblog cannot be found.
    You may lower these difficulties by using command SETMSGLVL (Set level of MMAIL messages). This command allows to
    • select the granularity of the joblog messages
    • collect MMAIL "trace" messages on a physical file.

                    Set level of MMAIL messages (SETMSGLVL)     
                                                                     
     Type choices, press Enter.                                      
    
     Joblog message level . . . . . . LVL     > 1           0, 1, 2
     Log msg.s to file MMAILDEBUG . . LOG     > *YES        *YES, *NO
     Debug message level  . . . . . . DBGLVL  > 1           1, 2
     Max no. of days to be logged . . MAXDAYS   7           1-7            
     Max no. of MMAILDEBUG rec.s  . . MAXRECS   30000       1000-9999999   
    

    Use this command to set the level of joblog MMAIL messages and optionally log these messages on file MMAILDATA/MMAILDEBUG.

    • Joblog message level (LVL) - Select one of the following:
      • 1 do not log to the joblog MMAIL basic messages nor MMAIL process tracing message
      • 1 to log to the joblog only MMAIL basic messages
      • 2 to log to the joblog also MMAIL process tracing messages.
    • Log messages to file MMAILDEBUG (LOG) - Whether messages (of whatever level) should also be logged on database MMAILDATA/MMAILDEBUG.
      Displaying file MMAILDATA/MMAILDEBUG makes it easier to understand the processes performed by MMAIL in sending e-mail messages.
      Select one of the following:
      • *YES - Log messages to file MMAILDATA/MMAILDEBUG
      • *NO - Do not to log messages to file MMAILDATA/MMAILDEBUG.
    • Debug message level (DBGLVL) - Select one of the following:
      • 1 to log to file MMAILDATA/MMAILDEBUG only MMAIL basic messages
      • 2 to log to file MMAILDATA/MMAILDEBUG also MMAIL process tracing messages.
    • Maximum number of days to be logged (LOGDAYS) - Maximum number of days logged messages are retained on file MMAILDATA/MMAILDEBUG.
      Expired log messages are automatically removed.
    • Maximum number of MMAILDEBUG records (MAXRECS) - Maximum number of records that file MMAILDATA/MMAILDEBUG can hold.
      When the maximum number of records is reached, oldest records are automatically removed.

    • To have enhanced joblogs containing also MMAIL process tracing messages, run command SETMSGLVL LVL(2).
    Note that joblogs may become rather larger than they used to be.

    • To collect MMAIL process information across all jobs (in file MMAILDATA/MMAILDEBUG),
    run command SETMSGLVL LVL(2) LOG(*YES).
    Parameters MAXDAYS and MAXRECS are used to prevent file MMAILDEBUG from becoming too large.

    The record format of file MMAILDEBUG is made of the following fields:

    • timestamp
    • qualified job name
    • message type:
      • *INFO - just information
      • *COMP - completion of a procedure or a command
      • *DIAG - exception found during process
      • *ESCAPE - unrecoverable error causing process interruption
    • Message text.

    To display this file, run command DSPF MMAILDATA/MMAILDEBUG.

     
        Contact