Operating System - OpenVMS
1753300 Members
7215 Online
108792 Solutions
New Discussion

DCL code for setting mail forwarding

 
SOLVED
Go to solution
Niall Godwin
Advisor

DCL code for setting mail forwarding

Can one of you DCL Wizards help me with the following:

I want to modify my DCL procedure for creating user accounts, and add code to forward the user’s mail to his/her internet mail account.
The OpenVMS account Owner is in the format space space .
The user’s internet address is in the format period period .

I want the code to execute the following command:
MAIL> SET FORWARD/USER= SMTP%"..@Example:
OpenVMS Username: JXB12345
Owner: Joe X Bloggs
Forward Mail to SMTP%”joe.x.bloggs@xxx.com”

Thank You,
Niall.

7 REPLIES 7
Niall Godwin
Advisor

Re: DCL code for setting mail forwarding

Some punctuation characters got corrupted in the original message. Here it is again:

I want to modify my DCL procedure for creating user accounts, and add code to forward the user's mail to his/her internet mail account.
The OpenVMS account Owner is in the format space space .
The user's internet address is in the format period period .

I want the code to execute the following command:
MAIL> SET FORWARD/USER= SMTP%"..@Example:
OpenVMS Username: JXB12345
Owner: Joe X Bloggs
Forward Mail to SMTP%"joe.x.bloggs@xxx.com"

Thank You,
Niall.
Karl Rohwedder
Honored Contributor
Solution

Re: DCL code for setting mail forwarding

I think, MAIL accepts these commands not in the commandline, so you have to create a temorary workfile along like:
$ VMSuser = "JXB12345"
$ user = "JOE X BLOKE"
$ user1= F$element(0," ",User)+"."+ -
F$element(1," ",User) + "." + F$Element(2," ",User)
$ open/write lun tmp.com
$ write lun "$ MAIL"
$ write lun "set forward/user=""''VMSUser'"" -"
$ write lun "SMTP%""''UserX'@xxx.com"""
$ close/nolog lun
$ @tmp
$ delete tmp.com.

This is untested, typos may occur, pls. check before making productive...

regards Kalle
Jan van den Ende
Honored Contributor

Re: DCL code for setting mail forwarding

Niall,

Kalle's procedure should work, but,
building USER1 & using USERX
those should of course be the same.
It probably is better to NOT complicate things by splitting up your MAIL input line.
Better to make one long line.
(but if you do the line breaks exactly right for the generated lines it will work identical).

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Karl Rohwedder
Honored Contributor

Re: DCL code for setting mail forwarding

I promised a typo and there it was :-)

I made the line split to have it at a specific column and not to depend on the html input form. Bit I agre, normally I also prefer long lines instead of many continuation lines.

regards Kalle
Hein van den Heuvel
Honored Contributor

Re: DCL code for setting mail forwarding


I like a temp file for bulk updates.
For single updates, consider using a pipe:

$ pipe write sys$output "set forw smtp%""a@b.c""" | mail
$ pipe write sys$output "show forw" | mail
Y

This will allow for easy symbol substitution.

Hein.

Niall Godwin
Advisor

Re: DCL code for setting mail forwarding

The continuation character doesn't work when in the MAIL utility, so I've had to keep the command to one line.

The following code works:
(username and full_name are defined previously in the procedure.)

$ internet_name= F$element(0," ",full_name)+"."+ -
F$element(1," ",full_name) + "." + F$Element(2," ",full_name)
$ open/write setmailfwd sys$scratch:setmailfwd.com
$ write setmailfwd "$ MAIL"
$ write setmailfwd "set forward/user=''username' SMTP%""''internet_name'@xxx.com"""
$ write setmailfwd "EXIT"
$ close/nolog setmailfwd
$ @sys$scratch:setmailfwd
$ delete sys$scratch:setmailfwd.com;*

I've added the following to confirm:

$ open/write showmailfwd sys$scratch:showmailfwd.com
$ write showmailfwd "$ MAIL"
$ write showmailfwd "show forward/user=''username'"
$ write showmailfwd "EXIT"
$ close/nolog showmailfwd
$ @sys$scratch:showmailfwd
$ delete sys$scratch:showmailfwd.com;*

Niall
Niall Godwin
Advisor

Re: DCL code for setting mail forwarding

See my last comment for the solution.
Thanks to all, especially Kalle, for your help.

Niall