From: Paul [pmosteika@chobe.zko.dec.com] Sent: Thursday, March 02, 2000 5:47 PM To: Info-VAX@Mvb.Saic.Com Cc: Paul Mosteika - EVMS Subject: Use OpenVMS TCPIP SFF for a Work-around to Sending MIME Messages We have localized the problem of sending MIME messages to a PC (or other MIME capable reader) with TCPIP, and having the message decode or read and display properly as an attachment(s). We are currently working with TCPIP Engineering who is investigating a modification to address this problem in a timely manner. The image TCPIP$SMTP_MAILSHR.EXE is considered for modification, in particular the routine MAIL$PROTOCOL, to append MIME headers to the standard RFC 822 headers, thereby elimnating the NULL line (which causes the failure noted above). Until we know the results of this investigation and/or have a possible corrected image to test, we offer the following work-around as a temporary solution. There is an undocumented SMTP feature that can be used to send the MIME file. $ SMTP_SFF :== $TCPIP$SYSTEM:TCPIP$SMTP_SFF.EXE $ SMTP_SFF FileName_XX.MIME Paul Mosteika ... The SFF documentation follows ... 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 steps: 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 1.1.5.1. 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 1.1.5.3. 1.1.5.1 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: $ TYPE TEST_SMTP_SFF.TXT MAIL FROM: RCPT TO: DATA Date: Sun, 4 Aug 1996 14:48:14 -0400 Message-Id: <96080414481486@abc.com> From: green@abc.com (Charly Green - ABC-Corp engineering - (123)-456-7 890) To: green@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 address. 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. $ TYPE TEST_SMTP_SFF.MIME_MSG MAIL FROM: RCPT TO: DATA Mime-version: 1.0 Content-Type: multipart/mixed; boundary=OpenVMS/MIME.572522828.951855 Content-Transfer-Encoding: 7bit Message-ID: <572522828.0@> --OpenVMS/MIME.572522828.951855736 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. --OpenVMS/MIME.572522828.951855736 Content-Type: image/jpg Content-Transfer-Encoding: Base64 Content-Disposition: attachment; filename=51STUDE.JPG /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAsICAoIBwsKCQoNDAsNERwSEQ8PESIZGhQcK KigkJyctMkA3LTA9MCcnOEw5PUNFSElIKzZPVU5GVEBHSEX/2wBDAQwNDREPESESEiFFL . . . k2WKempVdBUqVKmgqVKlTQVKmpU0HpU1NTQelTU1B//Z --OpenVMS/MIME.572522828.951855736-- 1.1.5.2 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. 1.1.5.3 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 measures: 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. 1.1.5.3.1 Invoking SMTP from an Application TCPIP$SMTP_ MAILSHR.EXE contains a routine called TCPIP$SMTP_SEND_FROM_ FILE. This routine is declared as follows: unsigned int TCPIP$SMTP_SEND_FROM_FILE(infile_name, logfd, log_level) 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 optional. o log_level Specifies the level of diagnostics to use: either 1 (on) or 0 (off). The default is 0 (off). This argument is optional. o To call the routine, link with TCPIP$SMTP_MAILSHR.EXE/SHARE. 1.1.5.3.2 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: $ SMTP_SFF:==$TCPIP$SYSTEM:TCPIP$SMTP_SFF.EXE This command takes UNIX style parameters and passes them to TCPIP$SMTP_SEND_FROM_FILE. 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).)