- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- How to create a batch file to send email?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2011 11:35 PM
тАО12-26-2011 11:35 PM
I knew send email in VMS is: $mail
send ...
but, how to put those commands into com file of OpenVMS ?
Any suggest?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2011 11:45 PM
тАО12-26-2011 11:45 PM
Re: How to create a batch file to send email?
William,
you can send mail with one DCL command (see $ HELP MAIL EXAMPLES) like this:
$ MAIL/SUBJECT="..." filename "user@domain"
If you use SYS$INPUT instead of filename, you can put your mail text body into a DCL procedure immediately following the above command.
You can also include mail commands in a DCL procedure like this:
SEND/NOEDIT
This is the subject line
Then follows the body of the mail message,
$ EXIT
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2011 01:03 AM
тАО12-27-2011 01:03 AM
Re: How to create a batch file to send email?
Thanks, it's working, but I had one more question:
how to put variable into email title, such as:
$ val
send
the value is $val
$exit
it does not working.
Thanks again,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2011 01:12 AM
тАО12-27-2011 01:12 AM
SolutionWilliam,
it's not possible to put a variable name into an input stream read from the DCL command file itself and expect that variable name to be substituted with the current value of the variable.
Instead, you can use the one-line MAIL command, which allows you to specify the /SUBJECT string including variables (e.g. /SUBJ="text including ''val' ...", which get substituted or you can create a short DCL procedure file on-the-fly with the necessary values hard-coded,like:
$ OPEN/WRITE x mail.tmp
$ WRITE x "$ mail"
$ WRITE x "send"
$ WRITE x "no@email.com"
$ WRITE x "the value is ''val'"
$ WRITE x "$ EXIT"
$ CLOSE x
$ @X
$ DELETE/NOLOG/NOCONF mail.tmp;0
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2011 02:17 AM - edited тАО12-28-2011 12:15 AM
тАО12-27-2011 02:17 AM - edited тАО12-28-2011 12:15 AM
Re: How to create a batch file to send email?
It looks like you compared the DCL input stream with a Unix Here Document. As already said, DCL doesn't do variable expansion but Here Documents do.
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2011 06:01 PM
тАО12-27-2011 06:01 PM
Re: How to create a batch file to send email?
Volker,
Very appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2012 07:16 PM
тАО01-08-2012 07:16 PM
Re: How to create a batch file to send email?
You can use PIPE to get variables into MAIL messages without the need for temporary files.
$ OUT="WRITE SYS$OUTPUT"
$ Subj="Your Subject"
$ To="your@recipient.com"
$ var="Some text"
$ count=5
$ PIPE ( -
OUT "This is the body of the message" ; -
OUT "which may contain variables ''var'" ; -
OUT "or expressions ",count+1 ) | -
MAIL/SUBJECT="''Subj'" SYS$PIPE "''to'" > nl:
The trailing "> nl:" sends the "Enter your message below" prompt to the null device.