There are two ways to use this mail (POP3) client program. Primary interface is OS/400 command interface, "RCVM" which make it easier to run the program by providing default values and validate input fields. Java program "Rcvmail.class" runs by itself on OS/400 and even other Java execution environments.
Receive POP3 Mail (RCVM)
Type choices, press Enter.
Mail account . . . . . . . . . . ACCOUNT >
Password for the mail account . PASSWORD >
POP3 server name . . . . . . . . MAILSERVER *LOCALHOST
Communication timeout (sec) . . TIMEOUT 30
Directory to store mail . . . . HOMEDIR *HOME
Leave mail after received . . . LEAVEMAIL *NO
Replace cid in HTML part . . . . REPLACECID *YES
Receive mail log file . . . . . RCVLOGTYPE *RDB
Mail recieve log file name . . . RCVLOGFILE 'rcvmlog'
RDB directory entry . . . . . . RDBDIRE *SYSNAME
UserID for RDB . . . . . . . . . RDBUSERID *ACCOUNT
Password for RDB . . . . . . . . RDBPASS
追加のパラメーター
Debug output type . . . . . . . DEBUG *NO
Debug output stream file . . . . DEBUGFILE 'rcvmdebug.txt'
|
Most keywords are self-describing and you will find it easy to use.
Assuming that :
To receive a mail for user "xxxxx", run RCVM command as follows
> RCVM ACCOUNT(XXXXX) PASSWORD() TIMEOUT(10) RCVLOGFILE(pop3.rcvmlog) RDBDI RE(ISERIES) RDBPASS() DEBUG(*BOTH) Mail received. |
If you had not edited SOURCE(MAKE) and specified OUTPUT(*PRINT), you'll see annoying screen after execution, so just press enter to exit to 5250 screen. When successful, the received mails (and debug output if directory not specified) are stored in user home directory "/home/xxxxx".
Work with Object Links
Directory . . . . : /home/xxxxx
Type options, press Enter.
2=Edit 3=Copy 4=Remove 5=Display 7=Rename 8=Display attributes
11=Change current directory ...
Opt Object link Type Attribute Text
. DIR
.. DIR
rcvmdebug.txt STMF
JW370113.NOT DIR
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F12=Cancel F17=Position to
F22=Display entire field F23=More options
|
A mail may have multiple parts and all parts are store in the same directory, in this example, "JW370113.NOT". In this case, the directory contains four files.
"body.htm" and "body.txt" are mail body and the names are fixed by the program. "desktop.ini" is am attachment file. The last image file is inline image file which is reffered by the "body.htm".
When RCVM received mail(s) without problem, it writes mail receive log to log file specified by RCVLOGFILE paramter. As it is not possible to what character code people use, the log file "POP3/RCVMLOG" contains character data as UNICODE.. Run Query and see what has received.
> RUNQRY QRY(*NONE) QRYFILE((POP3/RCVMLOG)) |
If you want to use the log file from legacy languages and you want only single charset, access the log file via logical file which converts CCSID 13488(UTF-16 big endien) to other CCSID, such as 37 (US English).
> RUNQRY QRY(*NONE) QRYFILE((POP3/RCVMLOG))
WORK WITH DATA IN A FILE Mode . . . . : CHANGE
Format . . . . : RCVMLR File . . . . : RCVMLOGL
Received time (UTC): 2003-05-18-12.43.53.815000
POP3 server hostname: localhost
POP3 mail account: XXXXX
Mail store home dir: /home/XXXXX
Leave mail on server: false
Replace HTML CID: true
Debug option: both
Debug output file: /home/XXXXX/rcvmdebug.txt
'From' header: Somebody <foo@abc.com>
'To' header: "XXXXX@as400" <XXXXX@as400.bar.com>
'Subject' header: This is a test mail
F3=Exit F5=Refresh F6=Select format
F9=Insert F10=Entry F11=Change
|
The RCVM command is just a from-end to simple Java program "Rcvmail". You can use Java program Rcvmail directly even without AS/400. As the main purpose of creating this program is batch B2B or B2C data transfer, so I don't explain about this issue in detail. But if your AS/400 is out of service by some reason, it is worth to know how to run the program on Windows.
Install JRE or JDK to your Windows PC and run Rcvmail Java program without parameter.
E:\JavaMail>"D:\Program Files\IBM\Client Access\JRE\Bin\java" -cp .;mail.jar;act ivation.jar;jt400.jar Rcvmail Required parameter(s) missing. usage: java rcvmail account password [mailserver] [timeout] [homedir] [leavemail ] [replacehtmlcid] [rcvlogtype] [rcvlogfile] [rdbdire] [rdbuserid] [rdbpassword] [debug] [debugfile] |
To receive mails whitout AS/400 (DB2/400) connection, call the Java program as follows.
E:\JavaMail>"D:\Program Files\IBM\Client Access\JRE\Bin\java" -cp .;mail.jar;act ivation.jar;jt400.jar Rcvmail mail_account mail_password mail_server 10 . false true file rcvlogfile.txt xx xx xx both rcvmdebug.txt |
Notify that "file" is specified as rcvlogtype. In this case, Rcvmail does not try to connect to OS/400 and store mail receive log to specified file ("rcvlogfile.txt" in this example). Encoding of this file is also UNICODE (UTF-16 little endien), so you can open the log file using UNICODE enabled softwares, such as Notepad.exe on Windows XP or Excel 2002 (each field is tab-separated) for later use.
[Home]