Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

E-mail with attachments

&pagelevel(5)&pagelevel

An e-mail contains several attachments. The e-mail thus consists of the following parts:

  • Header

  • Message with headers

  • Attachment 1 with headers

  • Attachment 2 with headers

  • etc.

Accordingly, the mail reader creates the following files:

  • Two files for the message:

    • A file for the procedure for processing the message

    • A file for processing the message body

  • Two files for each attachment:

    • One file contains the attachment.

    • The other file may contain a procedure for processing the attachment.

    The names of the files created for the attachments are made up of the prefix, which is also used for the inline message, and a file name derived from the Content-Type or Content-Disposition headers.

Example 1: Processing the entire e-mail

The sample e-mail has two attachments: file1.txt and file2.txt. If you want to print the e-mail in its entirety, including the attachments file1.txt and file2.txt, the corresponding section of the configuration file looks like this:

MAILHANDLING = PARAMETERS(
   ENTER = PROCEDURE,
   BODY = PARAMETERS(
     PROCEDURE = PARAMETERS (
        TEXT = ('/PRINT-FILE %FILE-NAME%'),
        ATTACHMENT = ('/PRINT-FILE %ATTACHMENT-FILE-NAME%,-',
                      '/ COVER-PAGES=PAR(HEADER-PAGE-TEXT=''%CONTENT-TYPE%'')'
          )
       )
   )
)

This results in the following MAIL.2010-06-27.073001.PROC procedure:

/PRINT-FILE MAIL.2010-06-27.073001
/PRINT-FILE MAIL.2010-06-27.073002.file1txt,-
/ COVER-PAGES=PAR(HEADER-PAGE-TEXT='text/plain; name:"file1.txt"')
/PRINT-FILE MAIL.2010-06-27.073002.file2txt,-
/ COVER-PAGES=PAR(HEADER-PAGE-TEXT='text/plain; name:"file2.txt"')

The expression %CONTENT-TYPE% in the configuration file is substituted with the e-mail header received.

Example 2: Processing attachments

The sample e-mail has two attachments: file1.txt and file2.txt.
For the attachments file1.txtand file2.txt you can create your own procedures (e.g. with the following configuration file):

MAILHANDLING = PARAMETERS(
   ENTER = PROCEDURE,
   BODY = PARAMETERS(
       PROCEDURE = PARAMETERS (
          TEXT = ('/PRINT-FILE %FILE-NAME%'
          ),
          ATTACHMENT = ('/CALL-PROC %ATTACHMENT-PROCEDURE-NAME%,-',
                        '/  (FILENAME=%ATTACHMENT-FILE-NAME%)'
          )
       )
   ),
   ATTACHMENT = PARAMETERS (
       PROCEDURE = ('/BEG-PAR-DECL',
                    '/DECL-PAR FILENAME',
                    '/END-PAR-DECL',
                    '/CALL-PROCEDURE ATTPROC,(FILENAME=&(FILENAME))'
       )
   )
)

This results in the following MAIL.2010-06-27.073001.PROC procedure:

/PRINT-FILE MAIL.2010-06-27.073001
/CALL-PROC MAIL.2010-06-27.073002.file1txt.PROC,-
/  (FILENAME=MAIL.2010-06-27.073002.file1txt)
/CALL-PROC MAIL.2010-06-27.073002.file2txt.PROC,-
/  (FILENAME=MAIL.2010-06-27.073002.file2txt)

In addition, the procedures MAIL.2010-06-27.073002.file1txt.PROC and MAIL.2010-06-27.073002.file2txt.PROC are created.

/BEG-PAR-DECL
/DECL-PAR FILENAME
/END-PAR-DECL
/CALL-PROCEDURE ATTPROC,(FILENAME=&(FILENAME))