Configuring AS400 For Emails
Configuring AS400 For Emails
Document Description:
Basic e-mail is supported by the AS/400 operating system and requires very little modification to the
existing configuration of the AS/400. This document is intended as a pointer on where to look to
make configuration changes for the system.
There are also IBM Knowledge Base documents available on the internet at the following location.
Search for SMTP to view the relevant documents:
http://www-912.ibm.com/s_dir/slkbase.nsf/slkbase
The remainder of this document is in the form of notes made when configuring SMTP mail on an
AS/400. The requirement that we had was for the AS/400 to send interface files to a third party
using SMTP mail, there was no requirement for the AS/400 to receive mail and, I was told, this
would have required a change in the mail gateway at our corporate HQ.
Generally, Microsoft Exchange was used as the mail server for the business, and the AS/400
therefore had to link to the outside world through this.
Configuring SMTP
GO CFGTCP
Select option '20' (Configure TCP/IP applications)
Select option '12' (Configure SMTP)
This gives a new menu from which you will need to look at options 3, 10 and 12.
The important things we found were to ensure that the Mail Router was defined as our MS Exchange
Server (HDWINEX1) and that the Firewall setting was flagged as *YES. Both of these parameters
are found by paging down to the second display within the CHGSMTPA command.
ADDDIRE (Add Directory Entry)
You need to ensure that a directory entry exists for the Internet SMTP router. We also have one for
our MS Exchange server, but I can't remember if this was a hangover from the many attempts we
made at configuring SMTP on the AS/400.
Configure Distribution Services
Select option 12 from the Configure TCP/IP SMTP menu and the following screen is displayed.
You will need to access options 1 and 2 to configure a distribution queue and a routing table entry
for SMTP to work.
Selecting option 1 allows a distribution queue to be configured. The queue name that needs to be set
up is QSMTPQ which should have the following parameters.
Paging down allows the number of retries, etc to be set. The defaults for these values can be taken.
Returning to the mini-menu, option 2 allows the routing table to be maintained. A routing table
entry should be set up for TCP/IP with the following attributes:
CHGPOPA (Change POP Attributes)
We had a problem with attachments being MIME encoded due to their size when sent. The Message
Split Size shown in the CHGPOPA display allows you to set a maximum message size to be reached
before MIME encoding takes place. The default is 32 KB which we found to be way too small for
our interfaces and have placed a 2MB limit on the file instead.
It is possible to prevent MIME encoding for files larger than 2MB and an IBM Knowledge Base
document can be found at the following URL:
http://as400service.ibm.com/supporthome.nsf/document/10000051
STRMSF (Start Mail Server Framework) and ENDMSF (End Mail Server Framework)
Mails are sent using the Mail Server Framework and the commands required to start and stop this
service are STRSMF and ENDMSF. The STRSMF allows you specify the number of channels to
start and you should set this according to the expected number of e-mails you are going to send. We
have kept the default at 3 jobs.
To send messages using SMTP, the SNDDST command should be used. Messages can be sent either
as standard free format text, or as attachments. The following commands are examples for both:
As we used the e-mail service for sending interface files, we always used the *DOC message types
as shown in the first example. The following CL program is an example of how we used the e-mail
facility to send interface files to third parties:
/****************************************************************/
/* */
/* A S T R A D Y N E ( U K ) L T D */
/* */
/* 4 Knoll Road, Fleet, Hampshire. GU51 4PR */
/* */
/* Tel: 01252 400955 Fax: 01252 400956 */
/* */
/****************************************************************/
/* */
/* H A R L E Y O W N E R S G R O U P */
/* M E M B E R S H I P D A T A B A S E */
/* */
/****************************************************************/
/* (C) Astradyne (UK) Ltd, 1999 */
/****************************************************************/
/* */
/* PROGRAM DESCRIPTION */
/* */
/* Program : J57H09 */
/* */
/* Written By : Jonathan Mason Date: 15/06/99 */
/* */
/* Description: Produces a PC style file containing the New */
/* Members List for transmission to HA... */
/* */
/* */
/*À Parameters : *NONE */
/* */
/* */
/* */
/****************************************************************/
/* */
/* PROGRAM AMENDMENTS */
/* */
/* Ref By Date Description */
/* */
/* EMAIL JDM 31/07/00 Added processing to allow file to */
/* be sent by email automatically... */
/* */
/* / / */
/* */
/* */
/* */
/* */
/****************************************************************/
PGM PARM()
/* 0010 - Identify the controlling data area and determine whether or not the */
/* - interface can be run yet or if the last one completed normally... */
/* 0030 - Position to the start of the open query file and create the PC */
/* - file... */
MONMSG MSGID(CPF0000)
CALL PGM(P57H09) PARM(&CNT)
/* 0040 - Move the file to the HOGTRANS folder. The network path for the */
/* - file is: \\S44CB915\QDLS\HOGTRANS\ASSIST\H08xxxxx.CSV */
/* 00060 - Finally, clear the member used for the extract and reset the data */
/* - area... */
CLRPFM FILE(F57H09)
In the above program, the lines shown highlighted handle the e-mailing of the file. The e-mail
addresses are picked up from data areas, and the AS/400 interface data is copied to a fixed length file
and commas inserted using the CPYTOIMPF command. This command creates a comma separated
file on the AS/400 which is then placed in a shared folder using the CPYTOPCD command. The e-
mail address is checked to see if the file is to be sent, and if so the SNDDST command mails the
*.csv file from the shared folder.