OpenVMS Notes: MIME, SMTP, POP3, etc.

  1. The information presented here is intended for educational use by qualified OpenVMS technologists.
  2. The information presented here is provided free of charge, as-is, with no warranty of any kind.
Edit: 2022-11-08 (added a caveat to the $MIME section)

Introduction

References used below

MIME Utilities for OpenVMS

Encoding - Decoding Notes

sys$system:MIME.exe
  • can be used interactively or from batch
  • seems to be written with Command Line users in mind (MAIL, EDIT/EDT, etc.)
  • written/supported by OpenVMS Engineering
  • distributed with OpenVMS-7.3-2 and higher
  • works with all newer stacks
    • works with TCP/IP Services for OpenVMS as-is
    • works with TCPware if you define logical TCPWARE_SMTP_ALLOW_MIME_SEND (see notes below)
    • works with MultiNet if you define logical MULTINET_SMTP_ALLOW_MIME_SEND (see notes below)
  • older stacks may require a DCL work around
  • add this line to file sys$manager:sylogin.com

        $MIME :== $SYS$SYSTEM:MIME.EXE

MPACK.exe
MUNPACK.exe
  • can be used interactively or from batch
  • MPACK (Mime Pack)
    • to create a MIME document before sending
  • MUNPACK (Mime Unpack)
    • to extract attachments from a MIME document after receiving
  • the utilities are found on almost every UNIX or Linux system
  • Distributions
    • Unix - Linux
    • Windows
    • VMS and OpenVMS (sources and executables)
      • version 1.5 is located on OpenVMS Freeware Disk #5
      • version 1.6 (highly recommended) from Steven M. Schweda
        • http://antinode.info/dec/sw/mpack.html
        • binaries for VAX, Alpha and Itanium (but also contains the source code if you want to do a custom build) 
        • using the new "-t" (try harder) switch in MUNPACK will produce better text extracts than you will get with v1.5
        • OpenVMS Caveat: testing MUNPACK 1.6 on OpenVMS reveals the following slightly unexpected behavior (which may also be present with MUNPACK 1.5):
          •  The original author (John G. Myers) decided it would be nice to implement a file-collision avoidance scheme so that output files are never overwritten. To see what I mean, just run the program twice using the same input file.
          • Application HELP and release notes indicate this application-based file-collision avoidance feature can be turned off with command-line switch "-f"
          • Using "-f" on UNIX or Windows will cause files to be overwritten
          • Using "-f" on OpenVMS produces the expected behavior (MUNPACK thinks it is overwriting the file but RMS is just creating a new file with the same name but with a new version number WHICH IS VERY COOL)
      • on my OpenVMS system the inbound mail queue employs 30 workbench folders.
        1. A DCL script allocates the next available folder
        2. then cleans out the contents from the previous visitor
        3. then copies the mime-encoded payload
        4. then runs munpack16b -t -f 'filename'
        5. then tries to make sense of everything just generated
Send Script Notes

MMAIL.COM
  • you need to use MIME or MPACK first
  • then use this DCL script (MMAIL.COM) listed 4-pages below
  • use this script (MMAIL) is required for MultiNet v5.1 and earlier
  • use this script (MMAIL) is not required for MultiNet v5.2 or higher
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
  • you need to use MIME or MPACK first
  • this DCL script (MMAIL_TCPWARE.COM) is listed 4-pages below
  • this script (MMAIL_TCPWARE) is required for TCPware v5.7-2 and earlier
  • this script (MMAIL_TCPWARE) is not required in TCPware v5.8 (released March 2008) when enabled by these undocumented logical names:

        TCPWARE_SMTP_ALLOW_MIME_SEND

        TCPWARE_SMTP_MIME_TAG

    ...which have similar names to those documented in MultiNet (so see the MultiNet documentation above)

Using $MIME to Create/Send Attachments from OpenVMS Mail

	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)

OpenVMS-Editor Keypad-Help

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

Using $MPACK to Create OpenVMS Documents

$!
$! 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

Sending Zip Files as an Attachment (various stacks)

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
<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
MultiNet v5.2 (or higher)
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
TCPware v5.8 (or higher)
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)
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:

  • Install PINE, available commercially from Innosoft or free from Andy Harper. With PINE you can both send and receive MIME messages, if you have the appropriate viewers available.
  • If you are working from an X Windows display, you can use the OpenVMS version of Netscape Navigator or Mozilla. The mail download protocol chosen to access the mail server from the Navigator or Mozilla mail client can be POP or IMAP, with the former causing messages to be downloaded while the latter permits messages to be retained on the mail server. Most folks prefer IMAP for this reason.
  • MPACK/MUNPACK. To send a MIME mail, construct the message with attachments manually using MPACK. You cannot send the resulting file directly through MAIL because an extra blank header line will be inserted between your message and the OpenVMS MAIL headers, which will cause the message to appear as plain text in most mail programs. Some TCP/IP stacks provide a work around for this problem, and if that doesn't work, you should generally be able to force the message directly into the SMTP port of your mail machine. Examples of both methods are in: To read a MIME mail message, open it in MAIL, extract it to a file, then use MUNPACK to break out and decode the attachments.
    MPACK/MUNPACK tools are also available on OpenVMS Freeware V5.0.
  • With OpenVMS V7.2 and later, use the MIME tool supplied with OpenVMS.
Note: The following DCL stub (which can also be adapted for use from any high level language) demonstrates how a programmer can exploit the extra-blank-header-line bug to send HTML documents directly to an MIME-based email reader. This hack is so cool...
$    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							!

MMAIL_TCPWARE.COM (TCPware Version of MMAIL.COM)
(not required with TCPware 5.8)

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
$!

Mailing attachments from DCL with TCPware 5.8
(also works with MultiNet)

$!============================================================ 
$! 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"                               		!

Using a MIME template to send a high 'priority email'

Implementation Notes:
  1. The reason we do this three times (see yellow highlights below) is to ensure we trigger logic in all popular email clients.
     
  2. Like all HTTP headers. You need a blank line between the last MIME directive and the beginning of the message payload.
     
  3. For processing correct code, a DCL-based program could use all the lines up to "Message-ID" as a template. After that you would invoke DCL lexical "f$unique()" to produce a new "Message-ID:". Then you would just tack on the plaint text message before invoking $MAIL
     
  4. Special note for spammers with visions of grandeur: sending an email with high priority will not cause your mail to be delivered any faster. It is only read by the receiving email client and may raise a red flag or enable a red exclamation
$!============================================================
$! 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.

Using TELNET to simulate an SMTP transaction

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:

Using TELNET to simulate an POP3 transaction

Notes:

  1. POP3 (Post Office Protocol) is only used to retrieve email from its final delivery location
    https://en.wikipedia.org/wiki/Pop3 (contains sample communications)
     
  2. POP3 was succeeded by IMAP4 (Internet Message Access Protocol)
    https://en.wikipedia.org/wiki/IMAP4
     
  3. Download an OpenVMS BASIC demo to show how to use TCPware to interface with a POP3 server
Many the parameters list below are not documented anywhere. Happy hacking!

External Links


Back to Home
Neil Rieck
Waterloo, Ontario, Canada.