如何编写VMS邮件正文的脚本?

时间:2021-11-08 19:30:51

I have a script that addresses and sends an email but I need a body in the message without creating a file and then inserting the file with the standard MAIL commandline.

我有一个脚本,可以处理和发送电子邮件,但我需要在邮件中使用正文而不创建文件,然后使用标准MAIL命令行插入文件。

How can I do that?

我怎样才能做到这一点?

2 个解决方案

#1


Assuming the body you want to create is something you can write to SYS$OUTPUT (e.g. the output of a command procedure or DCL command), then you can use DCL PIPE to pipe the output into VMS Mail, like:

假设您要创建的正文可以写入SYS $ OUTPUT(例如命令过程或DCL命令的输出),那么您可以使用DCL PIPE将输出通过管道传输到VMS Mail,如:

$ PIPE write sys$output "The date is ", f$cvtime() | MAIL SYS$INPUT smith/SUBJ="Piping in DCL"

or

$ PIPE DIR *.LOG | MAIL SYS$INPUT smith/SUBJ="Piping in DCL"

The PIPE command was added in OpenVMS V7.1. If you are somehow on an pre-7.1 system, then your only choice is writing to a temporary file and cleaning up.

PIPE命令已在OpenVMS V7.1中添加。如果你是在7.1之前的系统上,那么你唯一的选择就是写一个临时文件并进行清理。

Edit: To answer the comment, if you want to eliminate the interactive displays from the Mail command, you can redirect SYS$OUTPUT to NLA0:, as in:

编辑:要回答注释,如果要从Mail命令中删除交互式显示,可以将SYS $ OUTPUT重定向到NLA0:,如下所示:

$ PIPE DIR *.LOG |  MAIL SYS$INPUT smith/SUBJ="Piping in DCL" > NLA0:

Error messages go to SYS$ERROR, so you'll still see any failures. See HELP PIPE for more goodness.

错误消息转到SYS $ ERROR,因此您仍会看到任何失败。请参阅HELP PIPE以获得更多优点。

#2


Have the script create a temporary file to hold the body of the message.

让脚本创建一个临时文件来保存邮件正文。

Mail will accept a text file on the command line, like the list of users and the /subj

Mail将在命令行上接受文本文件,例如用户列表和/ subj

#1


Assuming the body you want to create is something you can write to SYS$OUTPUT (e.g. the output of a command procedure or DCL command), then you can use DCL PIPE to pipe the output into VMS Mail, like:

假设您要创建的正文可以写入SYS $ OUTPUT(例如命令过程或DCL命令的输出),那么您可以使用DCL PIPE将输出通过管道传输到VMS Mail,如:

$ PIPE write sys$output "The date is ", f$cvtime() | MAIL SYS$INPUT smith/SUBJ="Piping in DCL"

or

$ PIPE DIR *.LOG | MAIL SYS$INPUT smith/SUBJ="Piping in DCL"

The PIPE command was added in OpenVMS V7.1. If you are somehow on an pre-7.1 system, then your only choice is writing to a temporary file and cleaning up.

PIPE命令已在OpenVMS V7.1中添加。如果你是在7.1之前的系统上,那么你唯一的选择就是写一个临时文件并进行清理。

Edit: To answer the comment, if you want to eliminate the interactive displays from the Mail command, you can redirect SYS$OUTPUT to NLA0:, as in:

编辑:要回答注释,如果要从Mail命令中删除交互式显示,可以将SYS $ OUTPUT重定向到NLA0:,如下所示:

$ PIPE DIR *.LOG |  MAIL SYS$INPUT smith/SUBJ="Piping in DCL" > NLA0:

Error messages go to SYS$ERROR, so you'll still see any failures. See HELP PIPE for more goodness.

错误消息转到SYS $ ERROR,因此您仍会看到任何失败。请参阅HELP PIPE以获得更多优点。

#2


Have the script create a temporary file to hold the body of the message.

让脚本创建一个临时文件来保存邮件正文。

Mail will accept a text file on the command line, like the list of users and the /subj

Mail将在命令行上接受文本文件,例如用户列表和/ subj