问题描述
DEFINE VARIABLE wlc-Identifiant AS CHARACTER NO-UNDO.
DEFINE VARIABLE wlc-file-txt AS CHARACTER NO-UNDO.
wlc-Identifiant = STRING(YEAR(TODAY), "9999") + STRING(MONTH(TODAY), "99") + STRING(DAY(TODAY), "99") + REPLACE(STRING(TIME, "HH:MM:SS"), ":", "").
wlc-file-txt = wlc-Identifiant + "foo.txt".
DEFINE STREAM outStr.
OUTPUT STREAM outStr TO VALUE (wlc-file-txt).
FOR EACH customer NO-LOCK:
EXPORT STREAM outStr customer.
END.
OUTPUT STREAM outStr CLOSE.
RUN sendmail.p (INPUT wlc-file-txt). /* add the file in parameter */
/*OS-DELETE foo.txt.*/ /* It 's a cron job */
Sendmail.p
DEFINE INPUT PARAMETER wlpic-file-txt AS CHARACTER NO-UNDO.
DEFINE STREAM stMail.
OUTPUT STREAM stMail THROUGH
"mail_files -f [email protected] -t [email protected] -s\"subject\" -b~\" + wlpic-file-txt + "\").
PUT STREAM stMail "Email body".
OUTPUT STREAM stMail CLOSE.
推荐答案
在这种情况下,mail_files似乎是一个外部UNIX命令.可能是脚本.
In this case mail_files appears to be an external UNIX command. Probably a script.
使用mailx可能会获得非常相似的功能,几乎每个UNIX系统都可以使用该功能.
You might get very similar functionality using mailx which is available on pretty much every UNIX system.
如果-f在mail_files脚本中应该是发件人",那么-f可能会变成-r
If -f is supposed to be "From" in the mail_files script then -f probably becomes -r
同样,如果应该将-t设为至",它将被删除,mailx会假定一个未经修饰的参数是至"地址. Mailx将使用标准输入上的任何文本作为正文.因此,您无需写入-b,而是直接写入流中(您会看到"PUT STREAM stMail电子邮件主体".命令.)您可以使用-a将文件附加到mailx.
Likewise if -t is supposed to be "to" it just gets eliminated, mailx assumes an unadorned argument is the "to" address. Mailx will use any text on standard input as the body. So instead of -b you would just write to the stream (the 'PUT STREAM stMail "Email body".' command that you see.) You can attach a file with mailx using -a.
这篇关于是Mail_files是函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!