The command Clear Mail Log (APF3812/CLRMAILLOG) is closely linked with the APF3812/WRKMAILLOG command. Whenever you e-mail from InterForm400 both the e-mail and the status of the e-mail is stored in a log. If you want to purge old e-mails and log entries you can use the Clear Mail Log command. As default all entries older than 120 days will be deleted when you run this command:
Clear Mail Log (CLRMAILLOG)
Type choices, press Enter.
Mimimum days old . . . . . . . . MINDAYS 120 14-365 OutBox directory . . . . . . . . OUTBOXDIR *ALL Name, *ALL Reorganize physical file mbrs . RGZ *NO *NO, *YES
Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
The OUTBOXDIR (OutBox directory) can be used for specifying a specific sub directory (within /APF3812Home/OutBox), if you only want to clean up a specific subdirectory. With *ALL (default) all subdirectories will be cleaned for old e-mails.
You can also decide to reorganize the members of the physical files used for the mail log with this command. As default the members are not reorganized. For a description of what reorganizing is refer to the description of the OS400 command, RGZPFM.
The e-mails are stored in /APF3812Mail/OutBox.
Please notice, that this command only deletes old emails in the /APF3812Home/OutBox (and sub-directories) - it does not delete old emails, that has been saved via the save option on the email commands/functions. These saved emails are stored in the IFS in /APF3812Home/Log and you will need to clean up old emails yourself in this directory.
TIP: It is a REALLY good idea to run the CLRMAILLOG command on a regular basis to prevent excessive disk usage as the e-mails will build up in /APF3812Home/OutBox.
The command APF3812/ENDMAILSBS can be used for ending the APF3812/MAILINTER subsystem which is used for InterForm400 SMTP. The advantage of the ENDMAILSBS command compared to normal ENDSBS is e.g. that this will run faster.
As an administrator you might want to verify, if there should be a problem with any of the emails, that has been sent. That is visible in the email log, but if you use that, then you need to manually view and scroll across all of the emails - or subsets the email log to emails with a specific status.
An alternative to the email log is to use the command, APF3812/MAILREPSND (Send Daily SMTP status report by email). With this command you get an email with a report where the sent emails are counted per status, so that the receiver quickly can see how many of the daily emails, that was successfully sent and how many emails, that could not be sent.
The command looks like this:
Daily statistics for SMTP send (MAILREPSND)
Type choices, press Enter.
Send report to Email . . . . . . TOEML
Send report from Email . . . . . FROMEML
Option 0=Today 1=Yesterday . . . TYPE 0, 1
|
The parameters are:
Send report to Email, TOEML
State the email address of the receiver of the daily report email.
Send report from Email, FROMEML
Here you enter the email address to use for the daily report email.
Option 0=Today 1=Yesterday, TYPE
Here you select either of the values:
Select 0 to report all emails, that was generated today (since midnight).
Select 1 to report all emails, that was generated yesterday.
In a normal production environment you should consider to add an entry in the OS400 job scheduler to run this command every day.
This command, APF3812/MRGSPLFPDF can be used for creating PDF files containing the result of a merge in InterForm400. This PDF file can even be e-mailed as an attached file, directly from your System i.
Refer to the description of the SNDEML command below for a description of the fields MSGSTMF and MSGVARS and how to refer to an html file in the IFS.
NOTE: In order to get PDF output you need to purchase the PDF module for InterForm400.
Note: The command, APF3812/SNDEMAIL is considered obsolete. It is still supported, but it is recommended to use the SNDEML command instead as this command offers the same functionality and more.
The command APF3812/SNDEML is a newer version of both the APF3812/SNDMAIL and SNDEMAIL commands with the main difference that the SNDEML command is able to send to multiple receivers:
To view all the parameters you can first prompt the command with F4 and then press F9 to display all the parameters.
Send email (SNDEML)
Type choices, press Enter.
To email address: TOADR _ Email address . . . . . . . . ___________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ___________________________________ Name . . . . . . . . . . . . . *NONE______________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________ + for more values _ Subject . . . . . . . SUBJECT *NONE______________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________
More... F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
Message . . . . . . . MSG *NONE______________________________________ ___________________________________ *NONE, *STMF, *BLANK + for more values ___________________________________________ ___________________________________ Message stream file . MSGSTMF ___________________________________________ ______________ Message variables . . MSGVARS ___________________________________________ ______________________________________________________________________________ ______________ + for more values
Mail text format . . . MAILTXTFMT *TEXT *TEXT, *HTML Mail text adjustment . MAILTXTADJ *NONE__ *NONE, *CENTER, *RIGHT
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
Mail text embedded images . . . MAILTXTIMG *NONE
+ for more values
Attachment . . . . . . . . . . . ATTACH *NONE
+ for more values
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
From email address: FROMADR MyMail@interform400.com
Name . . . . . . . . . . . . .
Hold email . . . . . . . . . . . HOLD *NO *NO, *YES Save email . . . . . . . . . . . SAVE *NO Confirmation of delivery . . . . CFMDEL *NO
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
X-headers: XHEADER Keyword . . . . . . . . . . . *NONE
Value . . . . . . . . . . . .
+ for more values Index . . . . . . . . . . . . . IDX *NONE + for more values Index library . . . . . . . . . IDXLIB Archive directory . . . . . . . ARCDIR Archive . . . . . . . . . . . . ARCHIVE More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
Item type . . . . . . . . . . . ITMTYPE Data: DATA Field . . . . . . . . . . . . Value . . . . . . . . . . . .
+ for more values
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDMAIL)
Type choices, press Enter.
Reply-to email address: RPYTADR *NONE
Name . . . . . . . . . . . . .
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
Additional Parameters CC email address: CC
Name or group . . . . . . . . *NONE
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Send email (SNDEML)
Type choices, press Enter.
BCC email address: BCC
Name or group . . . . . . . . *NONE
OutBox directory . . . . . . . . OUTBOXDIR
Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Type ‘+’ in TOADR, CC or BCC if you want to add another receiver.
The message can be typed into the MSG field or you can refer to an html file in the IFS if you type *STMF in the MSG field and type the stream file name (html file) in the parameter MSGSTMF. You can even substitute any variable (*V1-*V9) typed either in the MSG text or in the SMTF referred to via MSGVARS. The first lines added as MSGVARS is substituted for *V1 the next for *V2 and so on..
Mail text format (MAILTXTFMT) indicates how the message of the e-mail is to be sent - either as simple text (in a fixed font) or with html commands within.
If you are specifying your own html either in the MSG parameter or in the referred html file, then you can also embed local images directly in the html - instead of linking to images, that are globally available . You can do that in two ways:
1. State a directory in which all the local images inside the html are stored in the MAILTXTIMG parameter. The html should then only refer to the image file names like e.g. <img src="bottom-banner1.jpg">.
2. List the images in the MAILTXTIMG parameter like:
MAILTXTIMG('/pcdata/temp/png/Interform-01-01.png' '/pcdata/temp/png/as400.jpg')
- and refer to the images by the number in the MAILTXTIMG parameter list inside the html e.g. like so:
MSG('<b>This email is from InterForm 400! :)</b><br>' 'Here is an image:<br>' '<img src="cid:image1" alt="Manual"><br>' 'Here is another image:<br>'
'<img src="cid:image2" alt="AS400">')
Remember to specify the FROMADR as the default value, *CURRENT will refer to the email information stored in system directory of the user running the current job. If you forget, you might get this error message:
Additional Message Information
Message ID . . . . . . : APF4705 Severity . . . . . . . : 00 Message type . . . . . : Information Date sent . . . . . . : 06/01/14 Time sent . . . . . . : 14:33:29
Message . . . . : No email address for sender (<USERID>) exists. Either specify an email address for the sender, or add the preferred name, SMTP user ID and SMTP domain (email address) to the system directory for user KSE. Use the Work with Directory Entries (WRKDIRE) command to add the user information, if you prefer to use the system directory.
|
To solve this error you need either to specify the sender or alternatively update the needed information for the user profile running the current job e.g. via WRKDIRE.
If you want to send to an email group, you should state it like ‘TOADR((*GROUP SALES_GRP))’, where MAIL_GRP is the name of the email group defined (written in capital letters).
HOLD
Holds the email. It will appear in the mail log with status= Held, from where you can send it later. This option is only supported for InterForm SMTP.
SAVE
Saves a copy of the email in the /APF3812Mail/Log directory.
For archiving in InterArchive you should use the parameters:
ARCHIVE
The archive to archive in.
ITMTYPE
The Interarchive Item type to archive as.
DATA
Fields and corresponding data to use for archiving.
OUTBOXDIR states the subdirecory (if any) to use (inside /APF3812Home/OutBox) to store the e-mail. If you state *CURUSR the directory will be the same as the owner of the original spooled file. The subdirectory will be created automatically, if it does not exist.
Note: In the ATTACH parameter you state the path and file name of the files you want to attach to the email. Up to max. 30 files can be attached.
The XHEADER field is described here.
Note: This command is considered obsolete. It is still supported, but it is recommended to use the SNDEML command above instead as this command offers the same functionality and more.
The APF3812/SNDMAIL command can be used for sending an E-mail from the System i with up to 30 attached files of your choice, but it does not support an InterForm400 merge in the same manner as APF3812/MRGSPLFPDF.
Note, that this command has the parameter: Confirmation of delivery (CFMDEL). With this you will get a confirmation e-mail when the receiver opens the e-mail. Note however, that this confirmation does not work with e.g. Notes.
Refer to the description of the SNDEML command above for a description of the fields MSGSTMF and MSGVARS and how to refer to an html file in the IFS. Please note that the html file referred to as MSGSTMF must be utf-8 encoded.
It is recommended to use the SNDEML command above instead as the SNDEML command can do the same as SNDMAIL - and send the email to multiple receivers.
The Send Mails command (APF3812/SNDMAILS) is to be used only by installations, that have chosen to use ‘3=InterForm SMTP (register only)’ in option ‘3. Configure email’ of the InterForm400 Configuration menu. It will send out any e-mails, that have been registered to be sent.
With option ‘3=InterForm SMTP (register only)’ the e-mails are only registered and stored waiting for execution of the command APF3812/SNDMAILS. Use the APF3812/WRKMAILLOG command to see any waiting e-mail (they will have status *READY).
The APF3812/STRMAILSBS command can be used for starting the APF3812/MAILINTER subsystem which is used for InterForm400 SMTP.
The APF3812/WRKMAILADR command enables the possibility to give access to maintenance of E-mail addresses without entering the InterForm400 menues. These addresses are used in combination with the E-mail finishing function.
The command should be called with a parameter, MAILTASK, that identifies the E-mail finishing definition to work with.
This command works exactly like the menu option ‘5. Work with email log’, which can be found via ‘80. Administering InterForm 400', ‘40. Email administration’.
The command can be called with these parameters:
Work with mail log (WRKMAILLOG)
Type choices, press Enter.
Job name . . . . . . . . JOB *ALL Name, *ALL User . . . . . . . . . . USER > *ALL Name, *ALL OutBox . . . . . . . . . OUTBOX > INVOICES Name, *ALL Text . . . . . . . . . . TEXT *ALL
From email address . . . FROMADR *ALL
To email address . . . . TOADR *ALL
Status . . . . . . . . . STATUS > *FAILED *ALL, *READY, *SENT... Views . . . . . . . . . VIEWS *ALL *ALL, *SUBJECT, *FROMADR... + for more values
Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
All of them selects a subset of the emails except the VIEWS field. The VIEWS field can be used for selecting which fields, that you want to include on the list of emails. Possible values are: *ALL,*SUBJECT, *FROMADR,*TOADR,*OUTBOX. You can select one or more of these fields.
The Work Mail Log Command (APF3812/WRKMAILLOG) shows a list of the e-mails, that have been sent:
Work with email log SMP100D
Position to . . . . . . Date Time
Type options, press Enter. 1=Send 3=Hold 4=Delete 5=Display 6=Release 11=Open email 12=Work with receivers
Opt Date/time Email text Status __ 11-27 16:47 Test *IBMSMTP *IBMSMTP __ 11-27 16:48 Test *IBMSMTP 2 *IBMSMTP __ 11-27 16:50 Test *IBMSMTP 3 *IBMSMTP __ 11-27 17:11 Test gennem IMAD01 *SENT __ 11-27 17:12 Test gennem IMAD01 *SENT __ 11-27 17:14 Test gennem IMAD01 *HELD __ 11-27 17:15 Test gennem IMAD01 *ERROR __ 11-27 17:23 Test gennem IMAD01 *ERROR __ 12-13 10:52 test1 *FAILED __ 12-13 14:53 *IBMSMTP __ 12-13 14:54 *READY More... F3=Exit F5=Refresh F11=View 2 F12=Cancel F15=Subset
|
With option 4=Delete you can delete emails, that have not been sent. To delete other emails you need to use the command, APF3812/CLRMAILLOG.
Possible statuses for e-mails sent via InterForm400 SMTP are:
*ERROR, *FAILED, *HELD, *READY, *RETRY, *SENT and combined *RSEF.
E-mails sent via OS400 SMTP cannot be monitored in the same details so such e-mails always have the status *IBMSMTP to indicate that the e-mail have been transferred onto the OS400 SMTP/MSF servers.
The other statuses means this:
(See details via option 12=Work with receivers if the status indicates a problem.)
*ERROR
Indicates that the e-mail could not be sent. InterForm400 SMTP tried once, but got an error message back. Perhaps the receiving e-mail account does not exist?
*FAILED
Indicates that InterForm400 attempted to send the e-mail more than once, but after all retry attempts the e-mail still could not be sent.
*HELD
An e-mail that have been registered to be sent (*READY), that have been held via option 3=Hold or generated with held. Refer to here for information of how to register e-mails. A held email can be sent via option 1=Send.
*READY
E-mails that have been registered to be send later (via the APF3812/SNDMAILS command).
*RETRY
InterForm400 SMTP did not succeed in sending out the e-mail in the first attempts but it is still trying...
*SENT
The e-mail have been successfully sent via InterForm400 SMTP.
*RSEF
This is a combined status of e-mails that are sent to multiple receivers. The status includes some of the letters R,S,E and F depending on the status of the e-mails sent to each receiver:
R is included if *RETRY or *READY is the status for at least one receiver.
S is included if *SENT is the status for at least one receiver.
E is included if *ERROR is the status for at least one receiver.
F is included if *FAILED is the status for at least one receiver.
With F15=Subset you can subset the list above to include only specific emails. You can e.g. chose to only see the emails in error or emails for a specific email address:
Subset list
Job name . . . . . . . User . . . . . . . . . OutBox . . . . . . . . Subject . . . . . . . . present From email address . . To email address . . . santa_claus@northpole.com From date/time . . . . DDMMYY HHMMSS To date/time . . . . . DDMMYY HHMMSS Status . . . . . . . . *ERROR *READY, *SENT, *RETRY, *ERROR, *FAILED, *IBMSMTP
F3=Exit F12=Cancel
|
You could e.g. use the subset above to subset the list to only include emails containing the phrase “present” in the subject for the email address “santa_claus@northpole.com”, which are in status “*ERROR”.
Regarding the status of the emails:
The email consists of 2 parts: user name and domain. The user name is to the left of the @-sign and then domain is to the right of the @-sign.
When you try to send an email, then there can be 3 error scenarios:
1.The domain does not exist or the receiving mail server does not answer within the specified retries.
2.The domain exists, but the user name does not exist.
3.The syntax of the email address is wrong (e.g. missing an @-sign or invalid characters are used).
Each scenario is handled like this:
1.If the domain does not exist: You will get an error in the InterForm400 mail log - status *ERROR or *FAILED.
2.If the domain exists and the user does not exist, then the status of the email will be *SENT, but the email address, which is setup as the sender will receive an email telling that the email could not be delivered. This scenario cannot be found in InterForm400 as the email goes directly to the sender.
3.If there is a syntax error in the email address e.g. a missing @-sign, then one of two things can happen:
a) If you on the email finish definition has selected option '13. Email address syntax error handler' and here setup an email address which will receive those emails with a bad email address. The email will contain this as the subject: 'Syntax error in email address: <wrong email address>' and the rest of the email (including attachments). The special subject is possible to use as a condition e.g. in F15=Subset above. |
|
b) If you have not setup a syntax error handler as above, then you will get an error message in the AFC job when you try send the email. |