<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create a batch file to send email? in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429121#M36664</link>
    <description>&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ OPEN/WRITE x mail.tmp&lt;/P&gt;&lt;P&gt;$ WRITE x "$ mail"&lt;/P&gt;&lt;P&gt;$ WRITE x "send"&lt;/P&gt;&lt;P&gt;$ WRITE x "&lt;A target="_blank" href="mailto:no@email.com"&gt;no@email.com&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;$ WRITE x "the value is ''val'"&lt;/P&gt;&lt;P&gt;$ WRITE x "$ EXIT"&lt;/P&gt;&lt;P&gt;$ CLOSE x&lt;/P&gt;&lt;P&gt;$ @X&lt;/P&gt;&lt;P&gt;$ DELETE/NOLOG/NOCONF mail.tmp;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Volker.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2011 09:12:20 GMT</pubDate>
    <dc:creator>Volker Halle</dc:creator>
    <dc:date>2011-12-27T09:12:20Z</dc:date>
    <item>
      <title>How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5428837#M36661</link>
      <description>&lt;P&gt;I knew send email in VMS is: $mail&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;send ...&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;but, how to put those commands into com file of OpenVMS ?&lt;/P&gt;&lt;P&gt;Any suggest?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 07:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5428837#M36661</guid>
      <dc:creator>WilliamGoGo</dc:creator>
      <dc:date>2011-12-27T07:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5428875#M36662</link>
      <description>&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can send mail with one DCL command (see $ HELP MAIL EXAMPLES) like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ MAIL/SUBJECT="..." filename "&lt;A target="_blank" href="mailto:user@domain"&gt;user@domain&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you use SYS$INPUT instead of filename, you can put your mail text body into a DCL procedure immediately following the above command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also include mail commands in a DCL procedure like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ MAIL&lt;/P&gt;&lt;P&gt;SEND/NOEDIT&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="mailto:user@domain"&gt;user@domain&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is the subject line&lt;/P&gt;&lt;P&gt;Then follows the body of the mail message,&lt;/P&gt;&lt;P&gt;$ EXIT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Volker.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 07:45:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5428875#M36662</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2011-12-27T07:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429073#M36663</link>
      <description>&lt;P&gt;Thanks, it's working, but I had one more question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to put variable into email title, such as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ val&lt;/P&gt;&lt;P&gt;$mail&lt;/P&gt;&lt;P&gt;send&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="mailto:no@email.com"&gt;no@email.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;the value is $val&lt;/P&gt;&lt;P&gt;$exit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it does not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 09:03:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429073#M36663</guid>
      <dc:creator>WilliamGoGo</dc:creator>
      <dc:date>2011-12-27T09:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429121#M36664</link>
      <description>&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ OPEN/WRITE x mail.tmp&lt;/P&gt;&lt;P&gt;$ WRITE x "$ mail"&lt;/P&gt;&lt;P&gt;$ WRITE x "send"&lt;/P&gt;&lt;P&gt;$ WRITE x "&lt;A target="_blank" href="mailto:no@email.com"&gt;no@email.com&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;$ WRITE x "the value is ''val'"&lt;/P&gt;&lt;P&gt;$ WRITE x "$ EXIT"&lt;/P&gt;&lt;P&gt;$ CLOSE x&lt;/P&gt;&lt;P&gt;$ @X&lt;/P&gt;&lt;P&gt;$ DELETE/NOLOG/NOCONF mail.tmp;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Volker.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 09:12:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429121#M36664</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2011-12-27T09:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429237#M36665</link>
      <description>&lt;P&gt;It looks like you compared the DCL input stream with a Unix &amp;nbsp;Here Document. As already said, DCL doesn't do variable expansion but Here Documents do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;If you have GNV installed, you can use its bash and then you can use the variable expansion. But if you have a DCL symbol (variable) then you need to set a corresponding variable to the symbol's value in the bash. That seems a lot more overhead than just writing a temporary file. Anyway, just for fun, with GNV/bash you can do:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;bash$ dcl "mail/subj=\"from $SHELL\" sys\$input becker_h" &amp;lt;&amp;lt;end&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;gt; from $HOME&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;gt; end&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;New mail on node NODE from NODE::BECKER_H &amp;nbsp; &amp;nbsp; "H Becker"&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;bash$&amp;nbsp;exit&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ mail&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;You have 1 new message.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;MAIL&amp;gt; 1&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; #1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-DEC-2011 03:52:31.38 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NEWMAIL&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;From: &amp;nbsp; NODE::BECKER_H &amp;nbsp; &amp;nbsp; "H Becker"&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;To: &amp;nbsp; &amp;nbsp; BECKER_H&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;CC:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;Subj: &amp;nbsp; from bash&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;from /disk_user/decuserve_user/becker_h&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;MAIL&amp;gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Dec 2011 08:15:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429237#M36665</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2011-12-28T08:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429817#M36666</link>
      <description>&lt;P&gt;Volker,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2011 02:01:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5429817#M36666</guid>
      <dc:creator>WilliamGoGo</dc:creator>
      <dc:date>2011-12-28T02:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a batch file to send email?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5441873#M36667</link>
      <description>&lt;P&gt;You can use&amp;nbsp;PIPE to get variables into MAIL messages without the need for temporary files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ OUT="WRITE SYS$OUTPUT"&lt;/P&gt;&lt;P&gt;$ Subj="Your Subject"&lt;/P&gt;&lt;P&gt;$ To="&lt;A href="mailto:your@recipient.com" target="_blank"&gt;your@recipient.com&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;$ var="Some text"&lt;/P&gt;&lt;P&gt;$ count=5&lt;/P&gt;&lt;P&gt;$ PIPE ( -&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUT "This is the body of the message" ; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;OUT "which may contain variables ''var'" ; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;OUT "or expressions ",count+1 ) | -&lt;/P&gt;&lt;P&gt;&amp;nbsp; MAIL/SUBJECT="''Subj'" SYS$PIPE "''to'" &amp;gt; nl:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trailing "&amp;gt; nl:" sends the "Enter your message below" prompt to the null device.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2012 03:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-to-create-a-batch-file-to-send-email/m-p/5441873#M36667</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2012-01-09T03:16:20Z</dc:date>
    </item>
  </channel>
</rss>

