You can create very advanced, dynamic email with variables without any programming. You can use an email finishing definition for that.
The email finish definition is able to split up an input spooled file and prepare distribution of multiple emails with PDF files.
You can also chose to email via a command.
The email setup is:
1.Define the email finish definition.
2.Prepare Auto Forms Control, where the email finish definition is called: Add a function C = Prepare for Finishing for the input spooled file.
3.The email finish definition creates two kinds of spooled files: NONMAIL and PRSPRINT: The NONMAIL cannot be emailed, and the PRSPRINT contains a header page for emailing.
4.The PRSPRINT spooled files should trigger a function: P = Send PDF email / Fax in Auto Forms Control.
If emailing does not work, then you should consider to check out the section, email troubleshooting.
You can work with the finishing functions, if you from the InterForm400 main menu choose 5. Work with Auto Forms Control and 4. Finish Definitions. You can now add a new finishing Definition by pressing F6:
Create Finish Definition PRS310D
Definition name . . . . . . DEMO______ Description . . . . . . . . Distribution of the Demo spool file____________
Type of Finishing . . . . . 05 01 = Prinserter 02 = Stapling per Recipient 03 = Prepare for inserting 04 = PFE Mail-Printer 05 = Prepare for E-mail/Fax 06 = PDF Filenaming 07 = Reformat Spooled File 08 = XML definition (classic version) 09 = XML+ definition (XML module required)
F3=Exit F12=Cancel
|
We are creating a new finishing definition for the InterForm400 Demo spool file.
Press Enter to create the finishing definition:
Work with email/Fax definition MAI300D Definition name . . . . . : DEMO_EMAIL CCSID ....: 00037 Description . . . . . . . : Demo email X-header Select one of the following options: 1. How to find email address 18. Email-ID definition 2. Key definition 3. Definition variables 4. Default PDF-file name 5. Definition email text 6. Definition recipient-ID 7. Email addresses 8. Senders email address 9. Encryption and Signature 10. PDF bookmark definition 11. PDF embedding definition 12. OutBox directory 13. Mail text embedded images 14. Email address syntax error handler 15. Define email XHEADERS 16. ZUGFeRD definition name 17. Archive in InterArchive Option: F3=Exit F12=Cancel
|
Below we go through the elements of the E-mail finishing definition and do the necessary setup in order to distribute the Demo spool file.
Work with E-mail/Fax definition MAI300D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spooled file
How to find E-mail address / Fax number
Select one of the following options:
1. By key 2. By user exit program 3. Find in spooled file 4. Send to spooled file owner Option: _
F3=Exit F12=Cancel
|
On the screen above you define how you intend to determine the e-mail address or fax number to send to for the individual pages. The selection here affects these other options:
1. By key
With this selection you tell InterForm400 to use a table in the email finish definition, where each entry should be typed in. You can define up to 3 keys, that are taken from the input spooled file text. These keys should uniquely identify the receiver. A key could e.g. contain the customer number. The receivers are maintained via option 7. Email addresses and Fax numbers or via the command, APF3812/WRKMAILADR.
It will open up option '2. Key definitions' but with the user exit program disabled.
2. By user exit program
If you want to find the email address via a user program or via an external database, then you select this option. The user program is defined via option 2. Key definitions, and the user program will receive the values of the keys to identify the receiver (the key could e.g. contain the customer number).
Will open up option '2. Key definitions' with the user exit program enabled. Option '7. E-mail addresses and Fax numbers ' will be disabled.
A video covering this is included here:
3. Find in spooled file
If you have the email address of the receiver(s) as text in the input spooled file, then you should select this option. You will be prompted for the placement in the spooled file and the email text format in option 6. Definition recipient-ID. It is possible to send to multiple receivers (also when you find the emails in the spooled file), if you state the email addresses (up to 9 is supported) in the spooled file without any spaces in between and delimited with a semicolon (;). This is possible both for normal receivers (*MAILADR) and CC receivers (*CCADR).
Options '2. Key definition' and '7. E-mail addresses and Fax numbers' will both be disabled. (The elements for the e-mail is found in option '6. Definition recipient-ID'). Please refer to special instructions.
A video describing the full process for finding the receiver email address in the spooled file is included below:
4. Send to spooled file owner
Send the email to the spooled file owner. The name and email address must be configured for the user profile in the system directory. You can work with the entries in the system directory with the command, WRKDIRE. Here you need to specifiy the name of the user:
Change Directory Entry
User ID/Address . . . . : KSE PMK11
Type changes, press Enter.
Description . . . . . . Kim Egekjær System name/Group . . . PMK250 F4 for list User profile . . . . . KSE F4 for list Network user ID . . . . KSE PMK11
Name: Last . . . . . . . . Egekjær First . . . . . . . . Kim Middle . . . . . . . Starup Preferred . . . . . . Kim Full . . . . . . . . Kim Starup Egekjær
More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F18=Display location details F19=Change name for SMTP F22=Remove name for SMTP
|
You also need to setup the email address by pressing F19=Change name for SMTP:
Change Name for SMTP System: PMK250 User ID/Address . . . . . : KSE PMK11
Type choices, press Enter.
SMTP user ID . . . . . . MyEmail SMTP domain . . . . . . . interform400.com
SMTP route . . . . . . .
F3=Exit F12=Cancel
|
The part before the @-sign is inserted as the SMTP user ID and the domain (the part after the @-sign) should be inserted as the SMTP domain as above. (The example above is for the email address: MyEmail@interform400.com).
These are the prerequisites in order to send an email to the spooled file owner via this option:
•You need to define a text version in option, 5. Definition email text / Cover page text.
•You need to add a sequence line in option, 6. Definition recipient-ID, and here define a position of the dummy key, *KEY1. You can e.g. refer to a blank position in the spooled file.
•In the system directory the spooled file owner need to have an email address registered as the SMTP information as shown above.
•In the system directory the spooled file owner need to have a ‘Preferred name’, which is not blank.
If any of these prerequisites are not met, a NONMAIL spooled file will be created (instead of a PRSPRINT), and no email will be sent.
Change E-mail/Fax key definition MAI310D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Length key field-1 . . . . __4 (1 - 30) Field type key field-1 . . 1 1=Numeric 2=Alfanum. 3=Alfanum. lowercase Allow blank key field-1 . N (Y N) Key field-1 description . Customer number_____
Length key field-2 . . . . ___ (1 - 30) Field type key field-2 . . _ 1=Numeric 2=Alfanum. 3=Alfanum. lowercase Allow blank key field-2 . _ (Y N) Key field-2 description . ____________________
Length key field-3 . . . . ___ (1 - 30) Field type key field-3 . . _ 1=Numeric 2=Alfanum. 3=Alfanum. lowercase Allow blank key field-3 . _ (Y N) Key field-3 description . ____________________
Mail exit program . . . . . __________ *NONE, name Library . . . . . . . . __________ F3=Exit F12=Cancel
|
Up to 3 keys can be defined. They are identifying the customers by e.g. customer number, department or name. These are the identifiers, that are looked for in the spool file.
You can decide to call a mail exit program. The finishing definition name, all keys and variables are transferred to the program, that can return e.g. what e-mail address to send to.
The user program should not only return the email address of the receiver(s), but also the email text format.
Sources for mail exit programs can be seen in member, MAILEXIT, MAILEXIT02, MAILEXIT03 and MAILEXIT04 in source file, APISRC in library, APF3812:
MAILEXIT
This is the first demo source that was made. (Use format = 01 when calling this). This program is mainly included backwards compatibility.
MAILEXIT02
This is called with parameter format=02. With this you can return the type of text for the contents of the e-mail. Refer to the description of 'Text and -format' for more details.
MAILEXIT03
Called with parameter format=03. Includes the functions of MAILEXIT02 and includes also the possibility to return an additional receiver of the e-mail (CC:).
MAILEXIT04
Called with parameter format=04. Includes the functions of MAILEXIT03 plus these parameters:
RTNTXTTYP |
Tells InterForm400 how to handle the text found in &RTNTXT01-10 - or if to use an external html file. |
RTNMSGSTMF |
If RTNTXTTYP is ‘X’ then the path and name of the html stream file is to be placed in this parameter. |
RTNUSRPWD |
The user password to the PDF file (The Digital Signature/PDF Security module is required.) |
CODPAG |
The codepage in which the returned parameters must be written - this normally contains the spooled file codepage as information for your exit program. If the AFC codepage is as *SPLFATR, then this contains the spooled file code page (if defined) or the codepage set in AFC. |
RTNTXTVER |
Return text version. The text version in the e-mail finishing definition to use (same as RTNTXTFNT in MAILEXIT03).
|
Apart from this you can return the name and e-mail address of up to 3 receivers - not counting the CC: and BCC: receivers. Refer to the source member for additional details. |
MAILEXIT05
Called with parameter format=05. This includes the parameters of MAILEXIT04 plus the parameter:
RTNBCCADR |
The return BCC e-mail address to send to. |
MAILEXIT06
Called with parameter format=06. This is a unicode version of MAILEXIT05 - making it possible to specify parameters for faxing/e-mailing in unicode. Please note that this format can only be used, when the prepare for finishing job specifies Unicode output = *YES.
MAILEXIT07
Called with parameter format=07. This includes the parameters of MAILEXIT05 except that you can now define up to 9 receivers of the e-mail:
RTNTOADR1 - RTNTOADR9 |
The e-mail addresses of the up to 9 e-mail receivers. |
RTNTONAM1 - RTNTONAM9 |
The names of the receivers. |
RTNSECATM |
Sets an extra optional attachment. |
MAILEXIT08
Called with parameter format=08. The parameter is a data structure which may be extended in future versions of InterForm400. The main addition is that an array of the 99 variables are included. Please notice that the RTNSECATM field is the return secondary attachment (an extra optional attachment - you set this to the IFS path to the file).
MAILEXIT09
Called with parameter format=09. Compared to MAILEXIT08 8 additional CC receivers can added. The extra fields are named ReturnToCCAdr<x> and ReturnToCCNam<x>, where <x> is a number in the range from 2 to 9.
If you want to send to an email group, then the mail exit program should return the name of the email group as the ‘Recipient name’, and the E-mail address should be *GROUP. This can e.g. be done with these commands in the program:
CHGVAR VAR(&RTNTOADR) VALUE('*GROUP')
CHGVAR VAR(&RTNTONAM) VALUE('SALES_GRP')
(The group name must be written in capital letters).
All exit programs called by InterForm400 must be owned by QSECOFR. If it is not the AFC job will halt with an error message. Change the owner with the command: CHGOBJOWN OBJ(library/program) OBJTYPE(*PGM) NEWOWN(QSECOFR).
In this example we intend to use the 4 digit customer number as the only key. If the spooled file includes the E-mail address in every page the keys are not necessary - just select '3. Find in spooled file' in option '1. How to find E-mail address / Fax number ' and specify the position in option '6. Definition recipient-ID '.
Change variables MAI315D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Variable Length Description *V01 _25 Company name_______ *V02 _25 Contact person_____ *V03 __4 Customer number____ *V04 _50 Subject____________ *V05 ___ ___________________ *V06 ___ ___________________ *V07 ___ ___________________ *V08 ___ ___________________ *V09 ___ ___________________ *V10 *V11 + Note: By using variables *V01-*V09 only, *V1-*V9 can be used as aliases for variables *V01-*V09. F3=Exit F12=Cancel
|
Up to 99 variables can be defined. They are read from the contents of each spool file page. The variables can be referred to in the subject, e-mail text, the name of the attached PDF file, the receiver E-mail address and receiver name. The variables are inserted as *V01 .. *V99 (use upper case 'V').
Above only the length of the variables are defined. Later on we define from where the variables should be fetched (That could depend of the contents of each page).
Here you can specify a default name for the attached PDF file. This name can be overridden for specific e-mail text definitions.
Work with Default PDF-file name MAI305D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Note: *NONE (in upper case) will result in an email without attachment.
Default PDF-file name . . Document_*V03.PDF__________________________________
Note: *NONE (in upper case) will result in an email without attachment.
Concat with PDF file . . . .
|
If you set the PDF file name to be *NONE (in upper case), then no PDF file will be attached when sending out the email. Please notice, that when calling the P = Send PDF email / Fax function an overlay or overlay selector is still required, but this will not be used when specifying *NONE above.
This field is optional. In this field you can insert the path and file name of a PDF file, that should be added/appended to the PDF files, that resulted in the merge between the overlay and spooled file. The path and file is fixed, and you cannot use variables as a part of the path and file name. The field can e.g. be used for adding general terms of delivery (or a page with a special offer) to the end of a PDF file without changing anything in the overlay(s) used.
The use of PDFCON require a license key, that includes the advanced PDF module. The use also require JAVA 1.6 and the AFC subsystem also need to run.
InterForm400 provides you with the possibility to include various texts in the e-mail depending on who you are e-mailing to. To do that you simply create 2 or more e-mail texts.
Below one E-mail text definition is made.
Change E-mail / cover page text MAI345D
Definition name . . . . : DEMO Description . . . . . . : Distribution of the Demo spool file
E-mail text version . . : GB________
Description . . . . . . . Demo spool file (English ver.)__ E-mail subject . . . . . . *V04____________________________________________ Text and -format . . . . . H T=Text, H=HTML, R=Raw HTML, X=External E-mail text . . . . . . . For *V02, *V01.____________________________________________________________ ___________________________________________________________________________ Please read the attached file containing a message for you from____________ InterForm A/S._____________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ The reason why you have received this mail is, that you are registered as__ our contact person at *V01.________________________________________________ Please let us know, if that is incorrect.__________________________________ ___________________________________________________________________________ Adjustment . . . . . . . . U (U C R) PDF-file name . . . . . . *DEFAULT________________________________________ Secondary attachment . . . /APF3812Home/Work/MyFile.PDF____________________ Attach as file name . . Fax cover page overlay . : IF400DEMO_ Name, *NONE F4=Prompt File set . . . . . . . . SAMPLE____ F3=Exit F10=Attachments F12=Cancel
|
The E-mail text version is a name identifying this e-mail text. Here we have created a text definition, that could be used for the english speaking customers (GB).
Text and -format: |
With this you specify how the e-mail text is to be presented in the final e-mail: |
T=Text |
The contents is shown in a fixed font (courier). |
H=HTML |
HTML codes are automatically inserted so the contents are shown in a proportional font (arial). |
R=Raw HTML |
Raw HTML codes in the contents can be included. |
X=External |
Use an external html file in the IFS for the contents of the e-mail. If you select ‘X’ you will be prompted for the file name and path. You can even use the variables *V01-*V99 in the text of the html file. The text in the html file must be utf-8 encoded. |
As the subject of the mail the subject from the spool file is used (*V4). In the message text we insert both the name of the receiver (*V2) and the company name (*V1). Variables could also be specified for the PDF file name.
Like the variables you can also insert either *FROM or *TO in order to insert the name of either the sender or receiver of the e-mail. *FROM and *TO are also replaced with the names in the used external html files.
We can create several different text definitions - e.g. one for each language code.
Adjustment can also be selected for the complete e-mail text: U=Unadjusted, C=Centred, R=Right adjusted.
If you set the PDF-file name to be *NONE (in upper case), then no PDF file will be attached when sending out the email. Please notice, that when calling the P = Send PDF email / Fax function an overlay or overlay selector is still required, but this will not be used when specifying *NONE above. Even if you specify *NONE for the PDF-file name above you can still specify and use a secondary attachment.
The fax cover page overlay is for fax support only. Faxing directly from InterForm400 requires the InterFax module.
When you insert variables in the subject of the mail: Make sure, that you leave enough space, so that the contents of the variable can be inserted on the same line.
If you want to add up to 7 extra attachments (apart from the PDF file, which is the result of a merge between the overlay and a spooled file), then you can specify the first one on the screen above. Specify *NONE, if you do not want an extra attachment.
You can even add up to 7 extra attachments, if you press F10=Attachments on the screen above. If you press this key, then you will see this screen:
Define Additional Attachments MAI346D Definition name . . . . : INVOICE Text version . . . . . . : ENGLISH Description . . . . . . : The english version Secondary attachment . . . *NONE Attach as file name . .
3. Attachment . . . . .
Attach as file name . . 4. Attachment . . . . .
Attach as file name . . 5. Attachment . . . . .
Attach as file name . . 6. Attachment . . . . .
Attach as file name . . 7. Attachment . . . . .
Attach as file name . . F3=Exit F12=Cancel
|
For each of the 7 extra attachments you can use variables as part of the name and path as well as for the name of the attachment. For the fields, Attachment you should specify the full path in the IFS to the extra file(s), that you want also to attach. So this could e.g. be /APF3812Home/work/Terms_and_Conditions.pdf. If you want to define another name for the name in the attachment than the name of the file in the IFS, then you can set this other name in the fields, Attach as file name e.g. Terms and conditions.pdf. For both the attachment and attach as file name you can use any of the variables, that you might have specified in option 3. Definition variables.
Fax cover page overlay and file set
This option is only visible, if Interfax is also installed. Here you can refer to an overlay to be merged with the header page of the PRSPRINT spooled file to form the cover page for the fax.
A Recipient-ID is a description, that tells where to find the keys and variables on the spool file pages. This is combined with a page selection criteria, that is already known from the sorting definition. The page selection criteria makes it possible to find the keys and variables in different places on the page depending on e.g. if either 'INVOICE' or 'CREDIT NOTE' is found in a special place.
In this example the keys and variables are always placed in a fixed position, and therefore the page selection criteria is left blank.
Update Finish Recipient-ID PRS330D
Definition name . . . . : DEMO
Sequence number . . . . : 1 Description . . . . . . . Demo Spool: Get keys and vars.
Page selection criteria
Print line Position Oper Compare value ___ ___ - ___ ____ ______________________________ ___ ___ - ___ ____ ______________________________ ___ ___ - ___ ____ ______________________________
Find recipient ID in the following positions Print line Position _13 _57 - _60 ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ F3=Exit F12=Cancel F13=Select spooled file F18=DSPSPLF
|
The functionality of F13 and F18 is described for the split defintion.
The Page selection criteria:
If all pages in a spooled file contains the recipient ID and variables in fixed positions, then you can do like above using only one sequence number and keeping the page selection criteria blank.
If you have multiple documents inside a spooled file and only the first page of each document contains the data for the variables, then you could use a condition for the page selection criteria like below:
Create Finish Recipient-ID PRS330D
Definition name . . . . : DEMO
Sequence number . . . . . 1 Description . . . . . . . Demo Spool: Get keys and vars.
Page selection criteria Print line Position Oper Compare value 1 1 - 8 EQ Page 1 - -
Find recipient ID in the following positions Print line Position 13 57 - 60 - - - - - F3=Exit F12=Cancel F13=Select spooled file F18=DSPSPLF
|
If the data for the variables and e.g. the recipient ID is moving up and down from page to page, then you can use multiple sequence numbers each with a special page selection criteria like below:
Create Finish Recipient-ID PRS330D
Definition name . . . . : DEMO
Sequence number . . . . . 1 Description . . . . . . . Get keys and vars in line 13
Page selection criteria Print line Position Oper Compare value 13 40 - 51 EQ Customer No: - -
Find recipient ID in the following positions Print line Position 13 57 - 60 - - - - - F3=Exit F12=Cancel F13=Select spooled file F18=DSPSPLF
|
Create Finish Recipient-ID PRS330D
Definition name . . . . : DEMO
Sequence number . . . . . 2 Description . . . . . . . Get keys and vars in line 14
Page selection criteria Print line Position Oper Compare value 14 40 - 51 EQ Customer No: - -
Find recipient ID in the following positions Print line Position 14 57 - 60 - - - - - F3=Exit F12=Cancel F13=Select spooled file F18=DSPSPLF
|
If you want that not all of the pages are emailed, then you can e.g. make sure that the email address for those pages is set to blanks.
Please note: You CANNOT exclude pages from being emailed by excluding the pages via the page selection criteria. Any page not selected by any page selection criteria will be included/emailed together with the last/previous selected page. If you e.g. imagine the 4 page demo spooled file of InterForm400 (which you can print out via option 1 in the service menu), then this single sequence number will email all pages to the same recipient (as only the first page of the spooled file is selected):
(The page selection criteria is only true for page 1 in the spooled file).
Update Finish Recipient-ID PRS330D
Definition name . . . . : DEMO
Sequence number . . . . : 1 Description . . . . . . . Demo Spool: Get keys and vars.
Page selection criteria
Print line Position Oper Compare value 13 57 - 60 EQ 1004 ___ ___ - ___ ____ ______________________________ ___ ___ - ___ ____ ______________________________
Find recipient ID in the following positions Print line Position _13 _57 - _60 ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ ___ ___ - ___ F3=Exit F12=Cancel F13=Select spooled file F18=DSPSPLF
|
Regarding the recipient ID:
You should also specify the recipient ID’s (=keys) in the bottom. This is used as a way to force a level break.
Normally it is advisable to specify all of the keys (and only the keys) here. But you can use this to split up one e-mail into several: A problem could be, that one E-mail address (=one set of keys) is sent to for several companies, but in order to ease distribution you want to create one E-mail per company. Specify for recipient ID a place on the page, that identifies the different companies (as well as the keys), and that is done automatic. Press Enter.
Update Finish Recipient-ID PRS330D
Definition name . . . . : TEST3
Sequence number . . . . : 1 Description . . . . . . . Demo Spool: Get keys and vars.
Enter where to find key(s) and variables in the print.
Field Description Length Printline Startposition Key-1 Customer Number 4 _13_ _57_ Key-2 0 ____ ____ Key-3 0 ____ ____ *V01 Company Name 25 __6_ __8_ *V02 Contact Name 25 _11_ _13_ *V03 Customer number 4 _13_ _57_ *V04 Subject 50 _15_ __8_
F3=Exit F12=Cancel
|
On this screen you define where the keys and variables should be found for the page selection stated on the last screen. If you in option '1. How to find E-mail address / Fax number' defined, that you want to find the e-mail address in the spooled file this screen will look like below:
Update Finish Recipient-ID PRS330D
Definition name . . . . : DEMOSPLF
Sequence number . . . . : 001 Description . . . . . . . all
Enter where to find key(s) and variables in the print. Field Description Length Printline Position Prefix *MAILADR Recipient email adr 1 1 *NAME Recipient name 50 11 13 *CCADR CC email adr *CCNAME CC Name 50 *FAXNO Fax number 25 *TXTVRS Text version 4 13 57 TEXT *MAILID1 CustomerNo 4 13 57 *V01 Company 40 6 8 *V02 Contact Person 40 11 13 *V03 Document number 4 13 57
F3=Exit F12=Cancel
|
In the screen above we imagine that we under ‘5. Definition E-mail text / Cover page text’ defined text versions named ‘TEXT1001', ‘TEXT1003' and ‘TEXT1004' for the demo Spooled file - and we expect the e-mail address would be added in line 1 from position 1. We use the prefix ‘TEXT’ and add the 4 digit number found in line 13 in position 57 after this prefix.
If we want to get the receiving e-mail address in the spooled file and we want just 1 fixed text version we can define the whole text version name without any spooled file data like below:
(Clear the Length, Print line and Position for the *TXTVRS line).
Update Finish Recipient-ID PRS330D
Definition name . . . . : DEMOSPLF2
Sequence number . . . . : 001 Description . . . . . . . all
Enter where to find key(s) and variables in the print. Field Description Length Printline Position Prefix *MAILADR Recipient email adr 1 1 *NAME Recipient name 50 11 13 *CCADR CC email adr *CCNAME CC Name 50 *FAXNO Fax number 25 *TXTVRS Text version TEXT *V01 Company 40 6 8 *V02 Contact Person 40 11 13 *V03 Document number 4 13 57
F3=Exit F12=Cancel
|
If you use a setup like above then you need just one text version named ‘TEXT’ in option ‘5. Definition E-mail text / Cover page text’.
If you want to send to an email group, you should as the *MAILADR refer to a place in the spooled file with the text ‘*GROUP’ (this must be inserted in the spooled file), and *NAME should refer to a place, where the name of the email group is found in the spooled file.
It is possible to send to multiple receivers (also when you find the emails in the spooled file), if you state the email addresses (up to 9 is supported) in the spooled file without any spaces in between and delimited with a semicolon (;). This is possible both for normal receivers (*MAILADR) and CC receivers (*CCADR).
E-mail addresses and fax numbers are lists of addresses, that InterForm400 can send to. The addresses are identified by the keys defined earlier. For each set of key(s) the e-mail/fax address, the name of the person, e-mail text version and a password for the attached PDF (if used) are registered.
Please notice that you can press <Page Down> on the address to add up to 3 receivers of the e-mail for the current key value. (You can also select multiple receivers with the e-mail exit program MAILEXIT04.)
NOTE: This option is only open if you have selected '1. By key' in option '1. How to find E-mail address / Fax number'.
WARNING: Password protection of the PDF file requires a purchase of the Digital Signature/PDF security module for InterForm400.
Work with E-mail addresses and fax numbers MAI320D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Position to . . . . . . _______________________ Customer number
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display
Opt Customer number _ 1004
End F3=Exit F5=Refresh F6=Create F12=Cancel
|
Press F6-Create to add a new E-mail address or fax number:.
Create E-mail address / Fax number MAI330D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Customer number . . : 1001
Recipient name . . . . Herring Marine Research___________________________ E-mail address . . . . Herring@interform400.com_______________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________ More... Or .. Fax number . . . ________________________ CC Recipient name . . __________________________________________________ CC E-mail address . . _______________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________ More... E-mail text version . GB________ F4=Prompt PDF User Password . . ___________________________________
F3=Exit F4=Prompt F12=Cancel
|
The More... text in the screen above indicates, that you can add additional receivers: If you press the <PageDown>/<PageUp> keys on your keyboard you can roll through all of the up to 9 possible normal and CC: receivers.
If you want to send to an email group, you should state the name of the email group as the ‘Recipient name’ above, and the E-mail address should be *GROUP.
The Recipient name above can be referred to as *TO in the e-mail text definition above.
For each receiver you specify what e-mail text version to use.
Note: Use the command APF3812/WRKMAILADR to give users access to edit these addresses without entering InterForm400.
NOTE: A PDF user password can only be used if the InterForm400 security module is enabled.
Work with E-mail sender information MAI350D
Definition name . . . . . : DEMO Description . . . . . . . : Distribution of the Demo spool file
Code for sender . . . . . . 1 1=Use fixed sender 2=Use owner of spooled file as sender 3=If possible, use owner of spooled file, else use fixed sender.
Organisation . . . . . . . . __________ (When 'Code for sender' = 2 or 3)
Fixed sender name . . . . . Kim Egekjaer____________________________________ Fixed sender E-mail adr. . . support@interform400.com________________________ _____________________________________________________________________________ _____________________________________________________________________________ __________________________________________ Send Bcc to sender . . . . . 1 0=No, 1=To email address, 2=To email group E-mail adr for Bcc copy . . _______________________________________________ _____________________________________________________________________________ _____________________________________________________________________________ __________________________________________ blank = senders E-mail adr F3=Exit F12=Cancel
|
In this option you specify who should be specified as sender on the e-mails:
1=Use fixed sender:
Use the name and E-mail address specified in the bottom for all E-mails.
2=Use owner of spooled file as sender:
If you specify this, then the user profile of the original spool file will be retrieved, and the name and E-mail address is extracted from information in the list of E-mail sender addresses found in 8. Work with E-mail senders in the Auto Forms Control menu. Note, that when you do this, then the sender e-mail address will be found by going through this list in this specific order when comparing with the registrations in 'Work with E-mail senders':
1. User profile and organisation
2. User profile
3. Organisation
3=If possible, use owner of spooled file, else use fixed sender.
A combination of the two codes above.
You can decide, that the sender should receive a copy (BCC - Blind Carbon Copy) of the sent E-mails.
Organisation: If filled out it can be used for the digital signature. Then it will be the digital signature of this organisation that is used for authentication of the PDF file and not the personal digital signature.
WARNING: Password protection and/or digital signature of the PDF file requires a purchase of the Advanced PDF module for InterForm400.
Work with Encryption and Signature Information MAI380D
Definition name . . . . . : FILENAME Description . . . . . . . : file naming
Type choices, press Enter.
Encryption information Encrypt PDF File . . . . . . . . . N (Y=Yes, N=No) User Access Restrictions . . . . . *NONE___ *NONE, *NOPRINT ... ________ ... *NOCOPY, *NOEDIT ________ PDF Owner Password . . . . . . . . *V01
Digital Signature Information Digitally Sign PDF File . . . . . N (Y=Yes, N=No) Certificate . . . . . . . . . . . __________ Name, *OWNER Organisation . . . . . . . . . . . __________
Signature Pad Information Sign PDF-file on sign pad . . . . Y (Y=Yes, N=No) Preview . . . . . . . . . . . . . N (Y=Yes, N=No)
F3=Exit F5=Refresh F12=Cancel
|
In this screen you can specify if you want to encrypt or digitally sign the attached PDF file - if you e-mail.
Here is the explanations of the fields to fill in:
Encrypt PDF File:
State 'Y' if you want to encrypt the PDF file.
PDF owner Password:
State a password if needed, that will open all the created PDF files with authority to do all. If you want a dynamic owner password, then you can use a variable to set the password like indicated on the screen shot above. With *V01 you can e.g. refer to a variable, that you have defined via option 3. Definition variables. Remember however that it is probably a bad idea to include the same information in the attached PDF file, but you can of course exclude that in the overlay, that you merge with.
User access limitations:
*NONE |
Use this if you want no limitations on what the receiver can do with the created PDF file. |
*NOPRINT |
This limitation make it impossible to print the PDF file. |
*NOCOPY |
Disables the possibility to copy the contents (text or graphics) of the PDF file. |
*NOEDIT |
Makes it impossible to edit the PDF file. |
Digitally Sign PDF File:
Enables inclusion of a digital signature in the PDF file.
Personal Certificate:
Here you can either state the name of an already installed certificate or refer to the certificate of the spooled files owner or sender.
Organisation:
If you state *OWNER or *SENDER as the personal certificate, then the organisation stated will be used for looking up in the table shown in option '8. Work with E-mail senders' on the Auto Forms Control menu.
In this manner you can insert different signatures for the same sender/owner depending on the organisation related to the current distribution (or finishing definition). Refer to details of '8. Work with E-mail senders' below for more information.
NOTE: Digital signatures and passwords can only be used, if you have bought the AdvancedPDF module of InterForm400!
Signature Pad Information
Sign PDF-file on sign pad
State a ‘Y’ to indicate that you want to add a signature to the PDF file via a connected signpad. Refer to details in the description of the signpad module.
Preview
If activated this will make it possible to view the complete PDF file before signing it.
Work with Bookmark definition name MAI390D
Definition name . . . . . : EMAILFAX Description . . . . . . . : emailfax test
Bookmark definition name . . __________ Name, *NONE F4=List
F3=Exit F4=Prompt F12=Cancel
|
If you decide, that the attached PDF file (if you e-mail) should include bookmarks, you can specify what bookmark definition to use here. If you want no bookmarks you can state *NONE.
If you have purchased the PDF embed module and want to embed one or more files within the PDF file, that will be emailed, then you can use this option to select an embedding definition:
Work with PDF embedding definition MAI392D
Definition name . . . . . : DEMOEMAIL2 Description . . . . . . . : email the demo splf
PDF embedding definition . . EMBED Name, *NONE F4=List
F3=Exit F4=Prompt F12=Cancel
|
State *NONE if you do not want to embed any files in the PDF file.
With this option you can state a special output directory in which to place the outgoing e-mail. The directory is a subdirectory inside /APF3812Mail/OutBox/. The subdirectory will be created , it it does not exist. If you use the default value of *NONE, then the e-mail will be stored in /APF3812Mail/OutBox/.
NOTE: Remember to regularly clean up old e-mails. This should be done with the command APF3812/CLRMAILLOG.
When you want to include images in the email contents you need to use html. (Refer to the text format for how to use html). With InterForm400 you can embed local images within the html instead of referring to globally available images.
A video concerning this feature is referred here.
If you do not embed the images in the html you will need to link to globally available images in your html. Linking to images (instead of embedding) has these downsides:
a. Some receivers will see this message when opening your emails:
(The message above occours if the receiver has chosen not automatically to download the images referred to in emails).
b. In worse cases the public image has been removed and the link in the email refers to a non-existing image. Then the receiver will see this:
So to avoid this you should use this way of embedding local images directly in the html.
The embedded images can be selected in these 2 ways:
1.State only the image name in the html file (as <img src="image in IFS">) and set the directory in which they are found via this option.
2.Refer to an image in html as cid:image1. Then the image including the path must be specified below:
Work with Mail text embedded images MAI396D
Definition name . . . . . : MAILEXIT Description . . . . . . . : demo mail exit 08
File or directory . . . . . /apf3812home/work/myfile.jpg
Note: Specify an image file to be embedded as "cid:image1", or specify a directory to embedd images by name.
F3=Exit F12=Cancel
|
You can also use variables as part of the path or image name(s).
Below an example of each use is illustrated with an example:
The screen above should state the path to the images (e.g. /apf3812home/work) and you simply state the image names in the html file:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
This is an image: <img src="image_file.jpg">.</body>
</html>
If you have specified the image including the full path in the screen shot above, then you can refer to the image inside the html like below:
<img src="cid:image1">
As any variables referenced in the html file are substituted initially you can even use variables as a part of the image name e.g.:
<img src="image_*V1.jpg">
The same feature is available in the SNDEMAIL command.
All of the address fields of the email finish definition are validated when entered via the menu, but email addresses can also origin from either the spooled file or a user exit program. Unless you use insert an email address, the AFC job running the ‘P=Send PDF email / Fax’ option will halt with an error if an invalid, nonblank email address is detected (e.g. missing an @-sign).
It is possible to add hidden information as X-headers inside the outgoing emails.
You can create special PDF files for invoicing, that fits the german ZUGFeRD standard. The XML+ module is required.
This option changes depending on which InterArchive that has been installed. After selecting the option you can switch between the archives with ‘F10=Change archive’ - if both archives are installed. The old InterArchive is no longer sold.
InterArchive
If you have installed InterArchive400, then the option will open this screen:
Work with Archive option IDX400D
Definition name . . . . . : ARCHIVE Description . . . . . . . : DEMO Archive emails
Archive option . . . . . . . 2 0=Dont archive, 1=Archive pdf file, 2=Archive email
Archive name . . . . . . . . MAI Item type . . . . . . . . . Demo
Field Value DOCNO *V1 DATE *SPLFDATE REGARDING *V3
F3=Exit F10=Change archive F12=Cancel
|
The InterArchive command FILITM will be executed in the Auto Forms Control job, when this is activated. You can assign values to the various fields as shown above. Please notice, that you can use variables and fixed constants as well as a combination of the two when assigning values to the fields in the screen above.
InterArchive require a date for archiving. If you can find a date in the spooled file you can define such a date as a variable and use that above, but you can also use the special value *SPLFDATE as shown above. To use this you need to declare the date field in InterArchive as having the format YYYY-MM-DD and 10 characters long.
Should the list of fields above not be complete for the specific item type, then the Auto Forms Control job may halt with this message:
Additional Message Information
Message ID . . . . . . : APF4771 Severity . . . . . . . : 00 Message type . . . . . : Inquiry Date sent . . . . . . : 19/03/12 Time sent . . . . . . : 16:31:18
Message . . . . : Error archiving email (R I C). Cause . . . . . : Error occured processing file /APF3812Mail/OutBox/KSE-2012-03-19-16-31-18-364000.eml - see joblog for more information. Possible choices for replying to message . . . . . . . . . . . . . . . :
R -- Retry. I -- Ignore archiving for this file. C -- Cancel operation.
Bottom Type reply below, then press Enter. Reply . . . .
F3=Exit F6=Print F9=Display message details F10=Display messages in job log F12=Cancel F21=Select assistance level
|
If you then look into the joblog you should see the reason in a previous message:
Filing of the item was canceled.
By placing the cursor on the message and pressing F1 you can see the second level information:
Additional Message Information
Message ID . . . . . . : UUA7007 Severity . . . . . . . : 00 Message type . . . . . : Escape Date sent . . . . . . : 19/03/12 Time sent . . . . . . : 16:31:18
Message . . . . : Filing of the item was canceled. Cause . . . . . : The filing of the item was canceled. Reason code 2 shown below describes the reason the operation was canceled. 1 - An error occurred during reading of fields 2 - Value not supplied for all fields 3 - Unknown origin specified 4 - Unknown ID in origin specified 5 - Local ID is not specified 6 - You canceled the filing by pressing F3=Exit 7 - You canceled the filing by pressing F12=Cancel 8 - The archive folder was not found 9 - Sort date is not specified More... Press Enter to continue.
F3=Exit F6=Print F9=Display message details F12=Cancel F21=Select assistance level
|
You can then correct the email finishing definition and try again (R-Retry).
Work with email definition MAI300D
Definition name . . . . . : DEMO Description . . . . . . . : Demo email
The email address syntax error handler is a person, that in case of email addresses witk syntax error, will recieve the email that can not be sent with subject text changed to:
Syntax error in email address : x--the invalid address --x
This user can then find the correct address and send the email manually.
Email address syntax error handler email address . . . . . . : admin@mydomain.com
*NONE, email address
When *NONE is specifioed, tha AFC-job will fail with a message in the QSYSOPR message queue in case of syntax errors.
F3=Exit F12=Cancel
|
If you can identify your emails via a unique key, then they you can use this feature to:
1.Verify the status of the email.
2.Find the .eml file in the IFS, that contains the email, that was sent. The end users can e.g. open the email from the IFS and forward it to someone else.
1.You need to use InterForm400 SMTP.
2.You need to setup up to 3 keys in this definition, that are selected from the spooled file, that can be up to 30 characters combined.
3.You need to state positions and lines of these keys in option 6. Definition recipient-ID of the email finishing definition. Inside this option the lines and positions of the mail-IDs are set on this screen. You can also set the Mail-ID in the SNDEML command and in the MRGSPLFPDF command. On the commands the 3 keys are however combined into one parameter.
4.You need to find the information via SQL as covered below.
If you select this option, then you will see this screen:
Define email-ID MAI312D
Definition name . . . . . : EMAIL Description . . . . . . . : MailID template
Mail-ID1 length . . . . . . 4 (0 - 30) Mail-ID1 description . . . CustomerNo
Mail-ID2 length . . . . . . (0 - 30) Mail-ID2 description . . .
Mail-ID3 length . . . . . . (0 - 30) Mail-ID3 description . . .
F3=Exit F12=Cancel
|
In the screen above you can define up to 3 fields for identification of the email. The length of the 3 field combined can be up to 30. Mail-ID1 in the example above is already defined with the length of 4, so that means that we have 26 characters available to be used by Mail-ID2 and Mail-ID3, if we would use them as well.
In order to create a unique combination of Mail-ID keys it is recommended to use e.g. one ID for the document number e.g. invoice number and another ID for the type of email e.g. the first three characters if found the in the spooled file text i.e. 'Inv'.
After you have defined your Mail-IDs, you need to tell InterForm400, where these texts for the Mail-IDs are found in the spooled file inside the same email finish definition. You do that via option 6. Definition recipient-ID. Inside this option you are prompted for the line and start position for each of the Mail-IDs, that you have defined like in the screen shown here.
When you have setup your email finish definition like described above or added a mail-ID in the , then you can look into how to do a lookup into one of the internal files of InterForm400, that contains the data for the email log.
The file is APF3812/SMPMSTP.
This file contains these fields (but this can be subject to change in the future):
Field |
Description |
Type |
Length |
Comment |
---|---|---|---|---|
SMPDAT |
Date in *ISO format |
Date |
10 |
Example: 2021-05-11 is 11th of May 2021 |
SMPTIM |
Time in *ISO format |
Time |
8 |
Example: 14.51.40 is 2:51 pm. |
SMPSEQ |
Sequence ID |
Packed |
11 0 |
|
SMPTXT |
Subject of the email (Text) |
Char |
50 |
|
SMPMID |
All Mail-IDs concatenated (Text) |
Graphic |
30 |
UCS2 encoded (13488). |
SMPF |
IFS path to .eml file |
Char |
256 |
Path including file name of the .eml file. Includes Outbox if used. |
SMPFRM |
From (Email sender) |
Char |
256 |
E-mail address of the sender. |
SMPJOB |
Job |
Char |
10 |
The name of the job that sent the email. |
SMPUSR |
User |
Char |
10 |
The user profile, that sent the email. |
SMPBOX |
Char |
10 |
Outbox or sub directory, where the .eml file is stored. |
|
SMPSTS |
Status |
Char |
10 |
The status of the email. |
When you want to do a look up in this file, then you should notice, that the SMPMID field is a graphic field, where the data is stored in unicode (UCS-2, code page 13488), so if you look at the contents as normal EBCDIC, then you will see data in this field, that looks strange, but if you do SQL, then you can actually let OS400 convert the data in UCS-2 encoding into the code page (CCSID) of the current job.
If the CCSID of your job is 65535 (*HEX), then OS400 cannot convert the data, so if that is the case, then you should consider to temporarily change the CCSID of the job into the codepage of your choice, but you need to be 100% sure, that the codepage is changed back.
Suggestions for SQL are found here: https://www.ibm.com/docs/en/i/7.1?topic=i-sql-tables
This CL program can be used as inspiration:
PGM
DCL VAR(&CCSID_OLD) TYPE(*DEC) LEN(5 0)
RTVJOBA CCSID(&CCSID_OLD)
IF COND(&CCSID_OLD = 65535) THEN(CHGJOB +
CCSID(1142))
RUNSQL SQL('INSERT INTO QTEMP/MYFILE +
(SELECT SMPF FROM APF3812/SMPMSTP WHERE +
SMPMID=''1004'')') +
COMMIT(*NONE)
MONMSG MSGID(CPF0000)
IF COND(&CCSID_OLD = 65535) THEN(CHGJOB +
CCSID(65535))
ENDPGM
The program change the CCSID of the job into the danish euro codepage (1142), if the codepage of the current job is 65535, then it looks up in the file APF3812/SMPMSTP for the records, where the Email-IDs combined is: 1004. The path for the emails are copied to the file QTEMP/MYFILE.
After running this command the QTEMP/MYFILE looks like below:
Display Report
Report width . . . . . : 256
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
SMPF
000001 /APF3812Mail/OutBox/KSE-2021-05-11-15-18-16-356000.eml
****** ******** End of report ********