The sources of the coding examples are available in the following source files:
- MMAIL/SAMPLEDDS
- MMAIL/SAMPLECL
- MMAIL/SAMPLECMD
- MMAIL/SAMPLERPG
The related objects are available in library MMAIL, while sample files are made available in library MMAILDATA.
This allows you to use the samples as they are. Never change samples in library MMAIL,
as they are refreshed in any subsequent MMAIL release.
If you need to replicate a sample in some library of yours, in order to customize it to your needs,
you should not only copy and compile the related sources, but you should also populate your library with the MMAIL
objects (service programs, etc.) needed for execution. This can be done through command
SETCGILIB.
The following coding examples are available
- Sending a message to a distribution list
- Dynamic EML... command in a CL program
- Dynamic EMLSTMF command in a CL program
- Retrieving info about the last e-mail message sent
-
Sending a message to a distribution list
This example allows to send to a given distribution list, documented in file DSTRLISTS,
a text written on an IFS stream file, and optionally another stream file as attachment.
The sender's data (name and e-mail) must be documented in file SENDERIDS.
The program can sends a separate personal message to each addressee in the distribution list,
or a single message to all the people in the distribution list, depending on parameter DSTTYPE in command MMAIL/EMLDST.
-
Dynamic EML... command in a CL program
Many people are asking how to build and execute a MMAIL/EML... command in a CL program.
See this example.
-
Dynamic EMLSTMF command in a CL program
In another case, a developer was asking how to build and execute an EMLSTMF command in a CL program.
See this example.
-
Retrieving info about the last e-mail message sent
Every time a mail message is sent from a MMAIL/EML... command using the QtmmSendMail system API, the following job environment variables are made available:
Environment variable | value | length | example |
---|
LAST_MAIL_FILE |
E-mail message IFS file |
512 |
/MMAIL/temp/Q59318.txt |
LAST_MAIL_SENDER |
Sender e-mail address |
256 |
jbsmith@gbtoys.net |
LAST_MAIL_RECIPIENTS |
Semicolon separated list of recipients e-mail addresses |
65535 |
CMWeber@gmail.com;admin@gbtoys.net; |
LAST_MAIL_SUBJECT |
Message subject |
512 |
Your last order to GBTOYS |
LAST_MAIL_TIME |
Date and time when message was sent |
31 |
Wed, 21 Jul 2021 14:32:40 +0000 |
See an RPG example of retrieving those environment variables.
|