[comp.os.vms] VMS Documentation Search -- mail interface

rrk@byuvax.bitnet (02/20/88)

I don't know where it is published, but here is a DCL command procedure
which uses the protocol.  It can similarly be used from a program in any
language via RMS:

It allows direct interaction with the DECNET mail server.
All usernames must be input in upper case as they must go to the server.
Send an ascii file or [tt] which is terminal input terminated by control-z.
Not elaborate, but it shows the basics of the interface.

$ !-------starts here.
$ read sys$command/end=abort node /prompt="What node should we send to: "
$ read sys$command/end=abort who /prompt="Who do you want to be: "
$ if node .eqs. "" then node=f$logical("sys$node")
$ nul=" "
$ nul[0,8]=0
$ open/append mailcom 'node'"27="
$ write mailcom who
$ c=1
$ d=0
$ to:=""
$ doloop:
$ a=f$element(c,",",to)
$ if a .eqs. "," then read sys$command/end=outloop to /prompt="Where should it go: "
$ if a .eqs. "," then if to .eqs. "" then goto outloop
$ if a .eqs. "," then c=0
$ if a .eqs. "," then goto doloop
$ write mailcom a
$ c=c+1
$ gosub get_stat
$ if stat .and. 1 then d=d+1
$ goto doloop
$ outloop:
$ if d .eq. 0 then goto done
$ write mailcom nul
$ read sys$command/end=done too /prompt="Where should it say it goes: "
$ write mailcom too
$ read sys$command/end=abort subj /prompt="Subject: "
$ write mailcom subj
$ get_what:
$ read sys$command/end=abort what /prompt="What goes: [TT] "
$ if what .eqs. "" then what:=sys$command
$ open/error=get_what file 'what'
$ file_loop:
$ read/end=end_file_loop/error=end_file_loop file x
$ write/error=end_file_loop mailcom x
$ goto file_loop
$ end_file_loop:
$ write/error=do_stat mailcom nul
$ do_stat:
$ if d .eq. 0 then goto done
$ stat_loop:
$ gosub get_stat
$ d=d-1
$ if d .ne. 0 then goto stat_loop
$ file_done:
$ close file
$ done:
$ close mailcom
$ abort:
$ exit
$ get_stat:
$ read mailcom x
$ stat=f$cvui(0,32,x)
$ if stat .and. 1 then return
$ loop_for_stat:
$ read mailcom x
$ tip=f$cvui(0,8,x)
$ if tip .ne. 0 then write sys$output x
$ if tip .ne. 0 then goto loop_for_stat
$ return