
Many applications running on OpenVMS
produce reports or messages which are distributed via email. The
software which comes with OpenVMS lets you do some simple things,
but many sites find the bundled tools inadequate.
VSM Software Services uses & recommends the PMDF
product set for serious email processing. PMDF includes command-line
utilities for sending complex messages with attachments and has
various mechanisms for processing incoming messages.
This page discusses some options for interactive
and automated processing of electronic mail on OpenVMS. Please contact
us if you'd like assistance with implementing any of any of these
techniques in your project.
VMS MAIL and the MIME
Utility
The two tools which come bundled with OpenVMS are
VMS MAIL and the MIME Utility. VMS MAIL cannot process messages
with attachments and has difficulty with long lines in messages.
It relies on the TCP/IP stack to provide any kind of SMTP mail capability,
but none of the TCP/IP stacks for OpenVMS add attachment handling
capabilities to VMS MAIL.
Hence OpenVMS Engineering created the MIME Utility,
which allows for the creation of files structured to the MIME standard.
(MIME is the Internet standard which specifies how a multi-part
mail message should be constructed.) The MIME Utility also allows
selected parts of a received message to be extracted, but automatically
extracting the message out of VMS MAIL is still problematic.
The other problem with the MIME Utility is that the
message files it produces have most of the necessary SMTP mail headers
(also called RFC822 headers) but it assumes the SMTP mail agent
provided by the TCP/IP stack will add the remaining headers such
as From, To and Subject. Unfortunately, the two sets of headers
don't get properly integrated and so the receiving mail system doesn't
properly process the message.
The result is that in many cases the MIME Utility
is only useful in environments where the sending and receiving applications
are able to be modified to handle the messages it produces.
Using PMDF to Send MIME messages
An OpenVMS system with PMDF installed on it provides
all applications and users on that system with the ability to compose
and send multipart mail messages which fully conform to all relevant
Internet standards. Such messages can be read by any of the popular
electronic mail clients or by software tools which process MIME
messages.
PMDF provides three utilities which are useful for
sending these messages:
- PMDF MAIL is a mail user agent which is
designed to be used instead of VMS MAIL. Any user or application
which currently uses VMS MAIL will easily adapt to using PMDF
MAIL. The SEND, REPLY and FORWARD commands have all been enhanced
to handle MIME-format messages.
Although targetted primarily at interactive users,
PMDF MAIL can be used by applications in two ways:
- The application can use a template command procedure
which contains the "interactive" commands in a set sequence.
For example:
$ PMDF MAIL
SEND/NOEDIT/ENCAPSULATE REPORT.TXT/FILE,RAW_DATA.DAT/FILE
db_team@remote.domain.tld
Today's report
$
- The files to be sent can be specified on the command
line:
$ PMDF MAIL/SUBJECT="Today's report" -
_$ REPORT.TXT/FILE,RAW_DATA.DAT/FILE -
_$ "db_team@remote.domain.tld"
The second approach tends to be the preferred one
since it allows for easy substitution of DCL symbols on the command
line (e.g. if the name of the file being sent varies each time the
job is run).
- PMDF SEND is specifically targetted at DCL
procedures which need to send MIME messages. It allows many of
the message headers to be set to specific values and provides
more options for controlling how the input files are processed
and encoded. If full specification of all mail headers is required,
PMDF SEND will let the application supply a text file containing
the message headers.
- PMDF PINE is a port of Washington University's
popular Pine email client. It's specifically designed for interactive
users who prefer a menu-driven interface to their email.
All of the above utilities are described in the PMDF
User's Guide.
Reading & processing incoming mail
using PMDF
Sometimes the only feasible way to get data to your
OpenVMS system is in the form of a mail message. Automatically processing
such a message to extract the data can be made somewhat easier with
PMDF.
Both the PMDF MAIL and PMDF PINE user agents can
disassemble MIME messages into their component parts and can invoke
local applications to process those message parts. For example,
upon reading a message containing an Adobe Acrobat file, PMDF MAIL
or PMDF PINE can automatically start a PDF viewer. However, PMDF
PINE is not suitable for use by automated DCL procedures and getting
such a procedure to successfully use PMDF MAIL can be tricky. Furthermore,
the procedure must have some way of detecting the arrival of a new
mail message.
Fortunately, PMDF provides another tool for handling
incoming email. The DELIVER Utility uses a control file in the destination
user's directory to automatically perform various actions upon receipt
of mail messages which match specified selection criteria. When
PMDF delivers a message to a local mailbox (i.e. an OpenVMS user
account) it checks for the presence of the control file (by default,
the file it looks for is MAIL.DELIVERY in the user's login directory)
and if this file is located PMDF uses the DELIVER Utility to process
the message.
DELIVER allows messages to be selected on the basis
of any of the message header fields. Usually this involves specifying
the sender and subject of the message, and an action to perform
when such a message is received.
Of particular interest here is the ability to perform
a DCL command, for example @PROCESS_EMAIL.COM .The
command is invoked in the context of a batch job which also has
available to it a file containing the message headers and another
file containing the message body. If a command procedure is being
invoked in thie way, the procedure can use various other PMDF utilities
or even the VMS MIME utility to get to the attachments.
DELIVER can even be used to process mail messages
received directly from another VMS MAIL session (i.e. which don't
arrive via PMDF's SMTP server).
An alternative strategy can be
used when the message structure isn't fully predictable but there
is some control over the source and destination addresses and the
MIME attachment type can be relied upon. PMDF's "CONVERSION
Channel" is a mechanism which processes messages according
to source, destination and MIME message type. It invokes a DCL command,
much like DELIVER can, but with the added benefit that the command
gets only a single message part at a time (not the entire message).
Hence the hard work of extracting the required part is already done.
|