OpenVMS
Notes: MIME, SMTP, POP3, etc.MIME (Multipurpose Internet Mail Extensions)
MIME (Multipurpose Internet Mail Extensions) is a technology for transforming plain text messaging into something more (like sending zipped attachments, images, binary data, etc.). Since Y2K, most up-to-date OpenVMS systems are able to create a ZIP file then mail it out as an attachment to PC users.
While MIME can be easily supported by any application programmer, interactive VMS users will probably want to use a MIME Utility to encode the data for them.
| Encoding - Decoding | Notes |
|---|---|
sys$system:MIME.exe |
|
MPACK.exe MUNPACK.exe |
|
| Send Script | Notes |
MMAIL.COM |
|
MMAIL_TCPWARE.COM |
|
Prep Comments $MIME :== $SYS$SYSTEM:MIME.EXE ! you should do this in SYS$MANAGER:SYLOGIN.COM $ZIP yada.zip *.txt ! create a demo zip file (copy some text files into the zip) Create MIME (interactive) Comments $MIME ! start the MIME application new neil.mime ! create a new mime document (starts default OpenVMS editor) this is a test ! enter some text into editor (then save it and exit back to MIME) add yada.zip /encode=base64 ! attach zip file to mime document save ! save mime document exit ! leave mime $ ! prompt (we're back in DCL) Create MIME (batch) Comments $MIME ! start the MIME application new/noedit neil.mime ! create a new mime document add yada.zip /encode=base64 ! attach zip file to mime document save ! save mime document exit ! prompt (leave mime) $ ! return to called (DCL or LIB$DO_COMMAND)
| EDIT/EDT
(a.k.a. EDT) Keystrokes |
Meaning |
|---|---|
| <PF1><KP7>exit<KP-ENTER> | save and exit |
| <PF1><KP7>quit<KP-ENTER> | don't save and exit |
| <PF2> | help (level 1) |
| <PF1><KP7>help<KP-ENTER> | help (level 2) |
| EDIT/TPU
(a.k.a. EVE) Keystrokes |
Meaning |
| <PF4>exit<ENTER> | save and exit |
| <PF4>quit<ENTER> | don't save and exit |
| <PF4>help<ENTER> | help |
$!
$! demo DCL script #1 (text-file)
$!
$ MPACK == "$sys$system:MPACK.EXE" ! define some foreign commands
$ MUNPACK == "$sys$system:MUNPACK.EXE" !
$ MIME == "$sys$system:MIME.EXE" !
$!
$ myfile = "yada.txt" ! file to attach
$ mpack -s "demo text attachment" -o neil.mime 'myfile' ! create mime equivalent
$!
$! mail methods:
$!
$! send "neil.mime" via VMS MAIL with "TCPIP for OpenVMS"
$! send "neil.mime" via @mmail_tcpware.com with "TCPware"
$! send "neil.mime" via @mmail.com with "Multinet"
$!
$! mail the document
$!
$@MMAIL_TCPWARE.COM neil.mime "neil.rieck@junk.ca" ! mail to a PC
$exit ! done
$!
$! demo DCL script #2 (XML-Excel)
$!
$ MPACK == "$sys$system:MPACK.EXE" ! define some foreign commands
$ MUNPACK == "$sys$system:MUNPACK.EXE" !
$ MIME == "$sys$system:MIME.EXE" !
$ mytemp == f$unique()+".tmp" ! create a unique file name
$!
$ myfile = "csmis_w301M_071101.xls" ! attache thisXMLLfilefile for Excel
$ mpack -s "demo text attachment" -o 'mytemp' -c -
"application/vnd.ms-excel" 'myfile' ! MIME encode the file
$!
$! mail the document
$!
$@MMAIL_TCPWARE.COM 'mytemp' "neil.rieck@junk.ca" ! mail to a PC
$exit ! done
| Examples | Notes | |
|---|---|---|
| 1a | <ur>use $MIME or $MPACK
to create a MIME equivalent <ur>$mail/subject="test TCPIP for OpenVMS" neil.mime - "neil.rieck@junk.ca" |
for: TCPIP Services for OpenVMS |
| 1b | <ur>def MULTINET_SMTP_ALLOW_MIME_SEND Y <ur>use $MIME or $MPACK to create a MIME equivalent <ur>$mail/subject="test Multinet for OpenVMS" neil.mime - "neil.rieck@junk.ca" <ur>def MULTINET_SMTP_ALLOW_MIME_SEND N |
for: Multinet v5.2 |
| 1c | <ur>def TCPWARE_SMTP_ALLOW_MIME_SEND Y <ur>use $MIME or $MPACK to create a MIME equivalent <ur>$mail/subject="test TCPware for OpenVMS" neil.mime - "neil.rieck@junk.ca" <ur>def TCPWARE_SMTP_ALLOW_MIME_SEND N |
for: TCPware v5.8 |
| 2 | <ur>$mail/subject="test-1"/foreign/type=1 neil.zip
- "neil.rieck@junk.ca" <sr>Sending FOREIGN message as generic MIME-encoded message notes: 1) MS-Outlook will receive a message with an attachment named "neil.zip" 2) When sending an XML attachment you'll find that part of the email header is still present (TCPware 5.7-2 and earlier) |
works with: TCPware 5.7-2 |
| 3a | use $MIME or $MPACK to create
a MIME equivalent download two DCL scripts (MMAIL_TCPware.COM) to send MIME docs via SMTP click here for an example |
required with TCPware 5.7-2 and earlier |
| 3b | use $MIME or $MPACK to create
a MIME equivalent download two DCL scripts (MMAIL.COM) to send MIME documents via SMTP click here for an example |
required with Multinet v5.1 and earlier |
|
6.2 How do I
send or read attachments in VMS MAIL? (from the VMSFAQ) Is there any way to send or read mail with files as attachments from VMS? Not directly with the OpenVMS MAIL facility, but there are several other options:
|
$ set noon
$ say :== write sys$output
$ ask :== inquire/nopunct
$ cr[0,8]=13 ! carriage return
$ lf[0,8]=10 ! line feed
$ subject="Port Utilization Report" + cr + lf + -
"Mime-Version: 1.0" + cr + lf + -
"Content-Type: text/HTML"
$ mail/sub="''subject'" neil.html "neil.rieck@junk.ca"
$fini: !
$ exit !
usage script p1 p2 p3 comment 1 @mmail_tcpware file.txt "neil.rieck@junk.ca" ! use mail queue 2 @mmail_tcpware file.txt "neil.rieck@junk.ca" yes ! copy to port 25
$!============================================================================= $! MMAIL.COM $! 1.0 original program for MULTINET $! 16-OCT-1995 David Mathog, Biology Division, Caltech $! $! MMAIL_TCPWARE.COM $! 1.1 modified for use with TCPWARE (works but needs to be more friendly) $! 2006-03-12 Neil Rieck (Kitchener, Ontario, Canada) $! $! 1.2 added RFC-821 compliant time stamps $! 2007-12-14 Neil Rieck (Kitchener, Ontario, Canada) $!============================================================================= $! This procedure mails one or more MPACK produced MIME files to one or $! more internet users. $! $! The method MMAIL uses is to make a direct entry onto the TCPWARE_SMTP queue. $! Obviously, this is TCPWARE specific, but something similar should work $! for other mailers. A second method is provided and has been tested $! on a TCPWARE system - it will likely need to be tweaked for $! other TCP/IP vendor's systems. This uses telnet to port 25 on localhost $! and standard SMTP protocols (which is a bit of a pain). $! Before MMAIL will work in the TCPWARE mode somebody with privs $! must modify the TCPWARE outgoing mail queue to accept submissions from W. $! $! P1 File(s) to be mailed - they WILL be deleted!!!! $! P2 Address(es) to mail to. $! P3 If defined, use second mode (via port 25) instead of TCPWARE mode. $! Subject should be inside the MIME messages produced by MPACK. $! Message-id should be inside the MIME messages produced by MPACK. $! $! Thanks to Aaron Leonard for suggesting this method of bypassing $! MAIL's unbypassable blank line between header and message body. $! $! Here are most of the TCPWARE specific pieces, there is also one $! TCPWARE specific line below. $! $ if(f$trnlnm("TCPWARE_ROOT") .nes. "" .and. "''P3'" .eqs. "") $ then $ whichqueue = f$trnlnm("TCPWARE_SMTP_QUEUE") $ sendit :== submit/que='whichqueue'/delete &fileo $ thisnode = f$trnlnm("TCPWARE_SMTP_HOST_NAME") $ method = "TCPWARE" $ else $ write sys$Output "WARNING, this is a demonstration mode only!" $ sendit :== @"'fileo'" $ inquire thisnode "enter your internet node name" $ method = "DEMO" $ endif $! $! pieces common to both methods $! $ now = f$time() ! $ username = f$getjpi("","USERNAME") ! $ username = f$edit(username,"COLLAPSE") ! $ tempname = "kill_" + username + "_" + - now - "-" - "-" - " " - ":" - ":" - ":" - "." $! $! produce an RFA-821 compliant date $! $ snap = f$time() ! snap shot of time $ day = f$cvtime(snap,,"DAY") ! $ month = f$cvtime(snap,"ABSOLUTE","MONTH") ! $ year = f$cvtime(snap,,"YEAR") ! $ hour = f$cvtime(snap,,"HOUR") ! $ min = f$cvtime(snap,,"MINUTE") ! $ sec = f$cvtime(snap,,"SECOND") ! $ zone = f$trnlnm("TCPWARE_TIMEZONE_NAME") ! $ yada = day +" "+ month +" "+ year +" "+ hour +":"+ min +":"+ sec +" "+ zone $! write sys$output "neil-debug: ",yada $! $! $! $! $ if("''P1'" .eqs. "") $ then $ type sys$input Here are examples of valid comma delimited file lists, telling MMAIL which files to send out (which also deletes them): outfile.txt or outfile*.txt or outfile1.txt, outfile2.txt, outfile3.txt, others.* **************************************************************************** * IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT: * * * * MMAIL deletes any file that it mails!!!! * * If this isn't what you want, hit ^Y now and make copies to mail. * * * * IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT: * **************************************************************************** $ inquire filelist "Please enter a comma delimited list of files to mail" $ else $ filelist = P1 $ endif $! $ if("''P2'" .eqs. "") $ then $ type sys$Input This procedure sends mail to a comma delimited list of internet addresses. For instance: "fred@what.where.com" or "fred@what.where.com, ginger@which.what.edu, astaire@dance.org" **************************************************************************** * IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT: * * * * Enclose everything in double quotes to maintain the case * * that you type, otherwise, it will be converted to upper case. This * * will usually break mail delivery to Unix systems, where the user's name * * is fred, not FRED! * * * * IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT: * **************************************************************************** $ inquire addresslist "Please enter the addresslist now" $ else $ addresslist = P2 $ endif $! $! Now start actually doing things $! $ open/write tfil: sys$scratch:'tempname'_header.txt $! $! $! $ if(method .eqs. "DEMO") $ then $ write tfil: "$ telnet/port=25/create/logical=telnet-nty localhost" $ write tfil: "$ copy sys$input 'f$trnlnm(""telnet-nty"")" $ write tfil: "HELO" $ endif $! $! This next section prepares a header file that will go on the front of $! each outgoing message. $! $ write tfil: "MAIL FROM:<''username'>" $! $! one or more valid addresses $! $count=0 $top_address: $ address=f$element(count,",",addresslist) $ if(address .nes. ",") $ then $ write tfil: "RCPT TO:<''address'>" $ count = count + 1 $ goto top_address $ endif $ address_count = count $! $ if(method .eqs. "TCPWARE") $ then $ write tfil: "ARRIVAL_TIME: ''yada'" $ endif $ if(method .eqs. "DEMO") $ then $ write tfil: "DATA" $ endif $ write tfil: "Date: ''yada'" $! $! These next two are self evident $! $ write tfil: "From: ''username'@''thisnode'" $ write tfil: "To: ''addresslist'" $! $ close tfil: $! $! Now, send all of the files $! $ ALLCOUNT = 0 $ COUNT = -1 $ lastfile="+++" $top_files: $ count = count + 1 $ file=f$element(count,",",filelist) $ if(file .nes. ",") $ then $ file = f$edit(file,"COLLAPSE") $ sent = 0 $! $! $! $top_out: $ ofile=f$search(file) $ if(ofile .eqs. lastfile)then goto top_files $ lastfile = ofile $ if(ofile .eqs. "") $ then $ if(sent .eq. 0) $ then $ write sys$output "Fatal error: ''file' does not exist" $ delete sys$scratch:'tempname'_header.txt.* $ exit $ else $ goto top_files $ endif $ else $ allcount = allcount + 1 $ fileo := "sys$scratch:''tempname'_''allcount'.dat" $ fileh := "sys$scratch:''tempname'_header.txt" $ filet := "sys$scratch:''tempname'_temp.dat" $ convert/fdl=sys$input 'fileh' 'filet' RECORD BLOCK_SPAN yes CARRIAGE_CONTROL carriage_return FORMAT stream_lf SIZE 32767 $ append/new 'filet','ofile' 'fileo' $ delete 'filet'; $ delete 'ofile' $ if (method .eqs. "TCPWARE")then sendit $ if (method .eqs. "DEMO") $ then $ open/append gfil: 'fileo' $ write gfil: "." $ write gfil: "QUIT" $ write gfil: "$! end of message" $ write gfil: "$ dealloc 'f$trnlnm(""telnet-nty"")" $ write gfil: "$ wait 00:00:01" $ close gfil: $ @'fileo' $ delete 'fileo'; $ endif $ sent = sent + 1 $ goto top_out $ endif $! $! $! $ goto top_files $ endif $! $ write sys$output - "''Allcount' files have been mailed to ''address_count' addresses" $ delete sys$scratch:'tempname'_header.txt.* $ exit $!
$!============================================================ $! title : mime_hack.com $! author : Neil Rieck $! created: 2008-06-12 $!============================================================ $! $ MIME :== $SYS$SYSTEM:MIME.EXE ! add this line to sys$manager:sylogin.com $! $ say := write sys$output ! $! $! method #1 (works as-is with TCPware 5.8) $! $ say "mailing test #1" ! $ mail/subj="mime test 1"/for/type=1 SCR-2008H1.zip "neil.rieck@junk.ca" $! $! method #2 (prep) $! $ say "building MIME file" ! $ wait 0:00:01 ! $ MIME ! start the MIME application new/noedit neil.mime ! create a new mime document add/encod=base64 SCR-2008H1.zip ! save ! save mime document exit ! prompt (leave mime) $! $! method #2 (works with new TCPware 5.8 logical) $! $ say "mailing test #2" ! $ def tcpware_smtp_allow_mime_send y ! we want new functionality $ mail/subj="mime test 2" neil.mime "neil.rieck@junk.ca" $ deas tcpware_smtp_allow_mime_send ! disable new functionality $ say "adios" !
Caveat: SMTP is only used to SEND mail
Notes : When your DCL-based-apps encounter problems sending through the VMS Mail client, just talk directly to
port 25 (you can do this in DCL by calling TELNET or from within a high level language like BASIC or "C")
Source: kawc15
Destin: kawc09
Legend: <ur> user response
<sr> system response
<ur> $telnet kawc09.on.bell.ca 25 ! connect to remote SMTP port <sr> %TCPWARE_TELNET-I-TRYING, trying kawc09.on.bell.ca,smtp (142.180.39.16,25) ... <sr> %TCPWARE_TELNET-I-ESCCHR, escape (attention) character is "^\" <sr> 220 kawc09.on.bell.ca Process Software ESMTP service V5.8-2 ready at Fri, 24 Apr 2009 17:14:45 EDT <ur> HELO kawc15.on.bell.ca ! begin by saying HELO, I am so-and-so <sr> 250 kawc09.on.bell.ca ; Hello kawc15.on.bell.ca [142.180.39.15], pleased to meet you. <ur> MAIL FROM:<neil@kawc15.on.bell.ca> ! <sr> 250 sender <neil@kawc15.on.bell.ca> OK ! <ur> RCPT TO:<system@kawc09.on.bell.ca> ! <sr> 250 <system@kawc09.on.bell.ca> OK - delivered as <system> ! <ur> RCPT TO:<custodian@kawc09.on.bell.ca> ! <sr> 250 <custodian@kawc09.on.bell.ca> OK - delivered as <custodian> ! <ur> RCPT TO:<dilbert@kawc09.on.bell.ca> ! <sr> 250 <dilbert@kawc09.on.bell.ca> OK - delivered as <dilbert> ! <ur> DATA ! <sr> 354 Start mail input; end with <CRLF>.<CRLF> ! <ur> Date: 24 Apr 2009 17:15 EDT ! <ur> From: neil@kawc15.on.bell.ca ! <ur> Subject: This is an SMTP hack ! <ur> To: system@kawc09.on.bell.ca, custodian@kawc09.on.bell.ca ! <ur> CC: dilbert@kawc09.on.bell.ca ! <ur> ! blank line indicates end of MIME block <ur> Dear Staff: <ur> <ur> Take the rest of the week off. <ur> <ur> Neil <ur> <cr><lf>.<cr><lf> ! this sequence escapes DATA mode <sr> 250 OK ; Job SMTP-NETMAIL (queue SMTP_KAWC09, entry 757) started on SMTP_KAWC09 <ur> QUIT ! we are done <sr> 221 kawc09.on.bell.ca Process Software ESMTP service V5.8-2 complete at Fri, 24 Apr 2009 17:16:24 -0400 <sr> $ ! DCL prompt
Notes : When an OpenVMS process sends to the local SMTP server, missing data is auto-filled by SMTP
Source: kawc15
Destin: 127.0.0.1
Legend: <ur> user response
<sr> system response
<ur> $telnet 127.0.0.1 25 ! connect to local SMTP port
<sr> %TCPWARE_TELNET-I-TRYING, trying localhost,smtp (127.0.0.1,25) ...
<sr> %TCPWARE_TELNET-I-ESCCHR, escape (attention) character is "^\"
<sr> 220 kawc15.on.bell.ca Process Software ESMTP service V5.8-2 ready at Fri, 24 Apr 2009 17:38:34 -0400
<ur> HELO kawc15.on.bell.ca ! begin by saying HELO, I am so-and-so
<sr> 250 kawc09.on.bell.ca ; Hello kawc15.on.bell.ca [142.180.39.15], pleased to meet you.
<ur> MAIL FROM:<neil@kawc15.on.bell.ca> !
<sr> 250 sender <neil@kawc15.on.bell.ca> OK !
<ur> RCPT TO:<nobody@nowhere.ca> !
<sr> 250 <system@kawc09.on.bell.ca> OK - delivered as <nobody> !
<ur> DATA !
<sr> 354 Start mail input; end with <CRLF>.<CRLF> !
<ur> To: nobody@nowhere.ca !
<ur> Subject: This is an SMTP hack !
<ur> ! blank line indicates end of MIME block
<ur> Dear Staff:
<ur>
<ur> Take the rest of the week off.
<ur>
<ur> Neil
<ur> <cr><lf>.<cr><lf> ! this sequence escapes DATA mode
<sr> 250 OK ; Job SMTP-NETMAIL (queue SMTP_KAWC09, entry 757) started on SMTP_KAWC09
<ur> QUIT ! we are done
<sr> 221 kawc09.on.bell.ca Process Software ESMTP service V5.8-2 complete at Fri, 24 Apr 2009 17:16:24 -0400
<sr> $ ! DCL prompt
Click here for more details:
Notes:
Back
to OpenVMS
Back
to Home