Skip to main content  
  Easy400   |       IBM Systemi home   |   RSS feed
Public Source
 
Introduction
Main utilities
5250 utility
Windows utility
Commands
Service program
Sample code
Examples of system API's
CGI support
FAQ
WEBMail
Bibliography
Index
 
Download
 
 

 
Search   
MIME & Mail for IBM System i
Coding examples

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

  1. Sending a message to a distribution list
  2. Dynamic EML... command in a CL program
  3. Dynamic EMLSTMF command in a CL program
  4. Retrieving info about the last e-mail message sent


  1.   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.

  2.   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.

  3.   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.

  4.   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 variablevaluelengthexample
    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.



    Contact