HP OpenVMS Systems

ask the wizard
Content starts here

MAIL, SMTP, MIME, and attachments? (take II)

» close window

The Question is:

I have managed to set up my vms and exchange so that I can send mail between
 the 2 systems. I have successfully sent an e-mail message with an attachment
 from exchange to vms mail. Is there any add-on or some other trick that will
 allow me to send a mail
message with an attachment from vms mail ?

The Answer is :

  The MIME tool provided in V7.2 and later, and the SFF (send from
  file) tweak referenced below, are required.
  Here is part of the documentation for a (currently undocumented
  and unsupported) TCP/IP Services for OpenVMS feature, a feature
  that is first documented and supported in the TCP/IP Services
  V5.1 release.  In the TCP/IP Services V5.4 documentation, look
  in the TCP/IP Services User's Guide for information on SMTP and
  SFF; for a more current version of the following material.
    1.1.5 Send From File (SFF) Mail Messages
          SMTP allows you to create a mail message in a file and
          send it to the SMTP mailer to be delivered with headers you
          specify. Using this feature, you can create automated tools
          that compose and send mail messages. It is also useful
          for forwarding non-text files (MIME), because it prevents
          the mailer from encapsulating the MIME and SMTP headers
          in the body of a new mail message. Thus, SMTP can function
          like the redirect command on your personal computer, which
          simply takes the message as is, without encapsulating it in
          another message, and sends it to the person you name.
          To redirect a MIME mail message so that it is readable on the
          other side (that is, without encapsulation), follow these
              1. From OpenVMS MAIL, use EXTRACT/NOHEADER to extract the
                 mail message.
              2. Exit the MAIL program.
              3. Modify the file to include the SMTP commands. For
                 example, put the address of the recipient into the RCPT
                 TO:<> line. For more information about the SFF format,
                 see Section
              4. Send the file to SFF.
          If you want headers like From:, To:, or Message-ID, you must
          include the SMTP headers themselves in the file. SFF adds only
          the Received: header, as described in Section
 Format of the SFF File
          The file is an RFC 822 message in a text file, with SMTP
          protocol commands (as described in RFC 821) preceding the
          RFC 822 message.  MIME, by definition, complies with RFC 822;
          therefore, MIME mail can be delivered using SFF.
          The SMTP protocol commands specify:
              1. The return path of the mail
              2. The recipients
              3. The DATA command
              4. The RFC 822 message
          For example:
          MAIL FROM:<nobody@compaq.com>
          RCPT TO:<nobody@compaq.com>
          Date: Sun, 4 Aug 1996 14:48:14 -0400
          Message-Id: <96080414481486@compaq.com>
          From: nobody@compaq.com (N O Body at Compaq)
          To: somebody@abc.com
          Subject: Test of SFF mechanism
          This is the message text.
          The commands that precede the RFC 822 messages must appear
          in the file in the order listed above. The MAIL FROM and
          RCPT TO commands form the "envelope," as described in RFC
          821 and summarized as follows:
          1. The MAIL FROM command specifies the address to which the
             mail is bounced if necessary. There must be one and only
             one MAIL FROM command.
             You can specify a blank MAIL FROM command. For example:
             MAIL FROM:<>
          2. The RCPT To command specifies the address of a
             recipient. There must be at least one RCPT TO command
             but there can be more, one for each recipient.
             You cannot specify a blank RCPT TO command.
             Each RCPT TO command must be on a separate line and
             may contain only one address. If the mail is to go to
             multiple addresses, include one RCPT TO command for each
          3. The DATA command follows the last RCPT TO command and
             flags the end of the RCPT TO commands and the beginning
             of the header block. The DATA command is required.
          Do not include a Return-Path header in the RFC 822 headers.
          If the mail is to be delivered locally, SMTP includes a
          Return-Path header based on the MAIL FROM command. If
          the mail is relayed to another SMTP host, the Return-
          Path is determined by the MAIL FROM command on the final
          destination host.
         The following is a partial example of a OpenVMS MIME encoded
         message.  Composed with the MIME utility, saved to a file, then
         edited to add the SMTP protocol commands and MIME headers.
          MAIL FROM:<system@compaq.com>
          RCPT TO:<anyone.listening@compaq.com>
          Mime-version: 1.0
          Content-Type: multipart/mixed; boundary=OpenVMS/MIME.572522828.951855
          Content-Transfer-Encoding: 7bit
          Message-ID: <572522828.0@>
          Content-Type: text/plain; charset=ISO-8859-1
          Content-Transfer-Encoding: 7bit
          Content-Disposition: inline
          We have modified this to send with SFF for SMTP - TCPIP
          Services for OpenVMS.
          Content-Type: image/jpg
          Content-Transfer-Encoding: Base64
          Content-Disposition: attachment; filename=51STUDE.JPG
 SFF File Requirements
              The text file can be in one of the following formats:
              o  Variable length
                 This type of file does not require carriage-return/line-
                 feed characters at the end of each line.
              o  Stream_LF
                 This type of file requires at least a line-feed at the
                 end of each line. It is not necessary to add carriage-
                 return characters.
 SFF Security Measures
              The ability to create messages with arbitrary headers
              could be used to spoof message headers. To limit this, the
              SFF mechanism is implemented with the following security
              o  The process must have either BYPASS, SYSPRV, or OPER
                 privilege set.
              o  SFF adds a Received: header to the headers you supply,
                 for tracking purposes. This way the origin of an
                 attempted spoofed message will be clear.
     Invoking SMTP from an Application
              TCPIP$SMTP_MAILSHR.EXE contains a routine called
              TCPIP$SMTP_SEND_FROM_FILE. This routine is declared as
              unsigned int TCPIP$SMTP_SEND_FROM_FILE(char *infile_name,
                  FILE *logfd, int log_level )
              The arguments for this routine are:
              o  infile_name
                 Specifies the name of the text file where the RFC 822
                 mail is located.
              o  logfd
                 If included, specifies the pointer to the file to which
                 to log diagnostics. This file must be opened by the
                 caller before calling this routine. If no log file is
                 specified, output goes to SYS$OUTPUT. This argument is
          o  log_level
             Specifies the level of diagnostics to use: either 1 (on)
             or 0 (off). The default is 0 (off). This argument is
          o  To call the routine, link with
 Invoking SFF from DCL   The SMTP_SFF command
          allows you to invoke SFF. To define SMTP_SFF as a foreign
          command so that you can use it from DCL, enter the
          following command:
          This command takes UNIX style parameters and passes them to
          The command format is:
          SMTP_SFF infile_name [-logfile logfile_name] [-loglevel log_level]
          Where the parameters to this command are:
          o  infile_name
             Specifies the name of text input file containing the
             SMTP mail to send.
          o  logfile_name
             Specifies the name of the log file for diagnostics. (The
             default is SYS$OUTPUT.)
          o  log_level
             Specifies the debug log level: either 1 (on) or 0 (off).
             (The default is 0 (off).)

answer written or last revised on ( 28-SEP-2004 )

» close window