Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!CitHex.Caltech.EDU!carl
From: carl@CitHex.Caltech.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: Synchronizing VMSMAIL.DAT with SYSUAF file
Message-ID: <871213091521.002@CitHex.Caltech.Edu>
Date: 13 Dec 87 18:59:03 GMT
References: <9732@ufcsv.cis.ufl.EDU>
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 68


 > It is interesting that you can put in "dummy" records  in  VMSMAIL.DAT  and
 > let  userA  receive  mail that was intended for unknown userB.  However, it
 > was also mentioned that whoever sent the mail should  be  notified  of  new
 > forwarding address.  Here is a way that might work.

It's a nice first try, but it only does what you want it to if userA and userB
are on the same machine (or, maybe, on the same homogenous cluster).

 > If you set the forwarding address of unknown userB to userA, set  it  to  a
 > list  so that is goes to something like:  userA,"please send mail to userA"
 > This is a nifty feature in mail.  You can set an invalid forwarding address
 > and it will let you do it.

Right.  MAIL has a tendency not to complain when you  do  something  wrong.
In some cases, this might be useful, but in others it's a nuisance.

 > However, when someone tries to send  to  you,  it  will  say  unknown  user
 > "whatever  garbage"  and  spit  back  the  text  that  was  invalid  in the
 > forwarding address.  I use this to "turn off my mail" ..  set forw "I  dont
 > want mail today." then when someone tries to send mail to me, they get this
 > message.  Try that.

This works as long as:
	1)  The entity trying to mail to you is logged in on the same machine
	    you use; and
	2)  The process sending the mail has a terminal associated with
	    SYS$INPUT.

If SYS$INPUT is not a terminal, the mailer will complain about the  invalid
address and will also fail to deliver the message to the valid address.  If
the mail is coming from another node, it will have the same problem.

 > Also, here is a spiffy little program that will check to see  if  there  is
 > new  mail, and also go right into mail so that you can read it (put this in
 > your login if you like AUTOMAIL !)
 > 
 > -----
 > $AUTO_MAIL: ON CONTROL_Y THEN GOTO MAIL_ABORT
 > $if f$search("SYS$LOGIN:MAIL.MAI").eqs."" then exit
 > $def/user sys$output nl:
 > $def/user sys$error  nl:
 > $search sys$login:mail.mai NEWMAIL
 > $if $status .eq. 148340819 then exit !no strings found (matched)
 > $def/user sys$input sys$command
 > $mail
 > $exit
 > $mail_abort: exit !or some other optional error message

The program makes the unsupported assumptions that you're storing all  your
mail in your login directory, and that any message in the NEWMAIL folder is
actually new.  Neither of these need be true, and it's easy to do it right:

$     	FILE = "SYS$SCRATCH:" + F$GETJ("00000000","PID") + ".TMP"
$	ON CONTROL_Y THEN GOTO DONE
$	ON WARNING THEN GOTO DONE
$	DEFINE/USER SYS$OUTPUT 'FILE'
$	MAIL
SELECT/NEW
$	DEFINE/USER SYS$OUTPUT NL:
$	DEFINE/USER SYS$ERROR  NL:
$	SEARCH/NOOUTPUT/EXACT 'FILE' "%MAIL-W-NONEWMAIL, no new messages"
$	SEVERITY = $SEVERITY
$	DELETE 'FILE';
$	IF SEVERITY .EQ. 1 THEN EXIT
$	DEFINE/USER SYS$INPUT SYS$COMMAND
$	MAIL
$ DONE:	IF F$SEARCH(FILE) .NES. "" THEN DELETE 'FILE';*