References used below
Encoding - Decoding | Notes |
---|---|
sys$system:MIME.exe |
|
MPACK.exe MUNPACK.exe |
|
Send Script | Notes |
MMAIL.COM |
MultiNet V5.2 Release Notes - April 2007
2.10.16 SMTP Two new SMTP logical names were added to allow sending the output of the OpenVMS MIME utility with MultiNet mail: MULTINET_SMTP_ALLOW_MIME_SEND (value is Y/T/1 to enable the new behavior, anything else to disable it) MULTINET_SMTP_MIME_TAG (value is what to look for at the start of the first line of the message. Optional. Defaults to "Mime-version:" Without the SMTP_ALLOW_MIME_SEND defined, the behavior will be as before. With it, if the first line of the message file being sent is the MIME tag, the blank line at the end of the header output will be suppressed so that the header lines in the message will be seen as header lines rather than message body. [9147] MultiNet V5.3 Install & Admin Guide
(Chapter 15)
MIME processing If the logical MULTINET_SMTP_ALLOW_MIME_SEND is defined to Yes, 1 or True, then if the first line of the message file being sent begins with the mime tag, the blank line at the end of the header section will be suppressed so that the header lines in the mime message file will be seen as header lines rather than message body. The string that is used as the mime tag can be controlled with the logical MULTINET_SMTP_MIME_TAG which defaults to "Mime-version:" |
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) $del/sym/glo edit ! mime can't deal with this redefined symbol (if it exists) $del/sym edit ! mime can't deal with this redefined symbol (if it exists) Create MIME (interactive only) Comments ----------------------------------------------------------------------------------
$show symbol edit ! any custom DCL symbol for here?
ED*IT == "EDIT/EDT" ! yes
$del/sym/glo edit ! so delete it
----------------------------------------------------------------------------------
$MIME ! start the MIME application new neil.mime ! create a new mime document (starts default OpenVMS editor)
! caveat: will fail if a custom DCL symbol exists this is a test ! enter some optional text into editor -OR- not
! then hit exit/save to go 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) $mail/subj=yada neil.mime "neil@123.ca" ! mail the new compound file Create MIME (batch or interactive) 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 caller (DCL or LIB$DO_COMMAND)
Legend: <pf1> = personal function key #1 (above key pad 7) <pf2> = personal function key #2 (above key pad 8) <pf3> = personal function key #3 (above key pad 9) <pf4> = personal function key #4 (above key pad +) <kp7> = key pad #7 <f7> = function #7 (above number key #7) <kp enter> = <enter> key on the keypad <enter> = <enter> key on the main keyboard
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<kp enter> | save and exit |
<pf4>quit<kp enter> | don't save and exit |
<pf4>help<kp 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
Legend: <ur> = user response
<sr> = system response ! = start of DCL comments
Examples | Stack | |
---|---|---|
1a |
! use $MIME or $MPACK to create a MIME equivalent <ur>$ mail/subject="test TCPIP for OpenVMS" neil.mime "neil.rieck@junk.ca" |
TCPIP Services for OpenVMS |
1b |
<ur>$ def MULTINET_SMTP_ALLOW_MIME_SEND Y |
MultiNet v5.2 (or higher) |
1c |
<ur>$ def TCPWARE_SMTP_ALLOW_MIME_SEND Y |
TCPware v5.8 (or higher) |
2 |
<ur>$ mail/subject="test-1"/foreign/type=1 neil.zip "neil.rieck@junk.ca" |
TCPware 5.7-2 (or higher) |
3a | use $MIME or $MPACK to create a MIME equivalent view MMAIL_TCPware.COM (a DCL script to send MIME docs via SMTP) |
TCPware 5.7-2 |
3b | use $MIME or $MPACK to create a MIME equivalent view MMAIL.COM (a DCL script to send MIME documents via SMTP) |
MultiNet v5.1 |
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 ! define DCL symbol: carriage return $ lf[0,8]=10 ! define DCL symbol: 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 vms 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 (Waterloo, Ontario, Canada) $! $! 1.2 added RFC-821 compliant time stamps $! 2007-12-14 Neil Rieck (Waterloo, 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" !
$!============================================================ $! title : SEND_FAKE_MAIL.COM (for TCPware 5.8) $! author : Neil Rieck $! created: 2009-03-16 $!============================================================ $ set ver ! $ def TCPWARE_SMTP_ALLOW_MIME_SEND Y ! enable new feature (process level) $ ! send to PC $ mail /subj="fake 1" AAA_fake_mail.txt "neil.rieck@junk.ca" $ ! send to my "Bell Canada" Cell Phone $ MAIL /subj="fake 2" AAA_fake_mail.txt "1112223333@txt.bell.ca" $ deas TCPWARE_SMTP_ALLOW_MIME_SEND ! disable new feature $ set nover ! $! $! $! $ type AAA_fake_mail.txt Mime-version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Priority: 1 X-MSMail-Priority: High Importance: high Message-ID: <410035.110453102851700775.1@OpenVMS.Mime.V1.93>
This is a test message from Neil. Bye For Now.
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 Dest : 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 HTTP header <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 Dest : 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 HTTP header <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: