繁体   English   中英

使用mailx和uuencode发送附件

[英]Sending attachments with mailx and uuencode

我正在尝试运行一个ksh脚本,该脚本通常位于新主机Linux节点上的AIX机器上。

我正在运行的代码如下所示:

 (uuencode $path/info.dat info.csv; uuencode $RESULTS results.log) | mail -s "Info" $MAIL_RECIPIENTS

这通常会发送一封主题为“ Info”的电子邮件,并包含附件info.csv和results.log。

但是在我的Linux机器上,这没有发生-它发送的电子邮件带有uuencode输出作为电子邮件正文,没有附件:

begin 775 info.csv

M+3`U+C`S+C4S+C(Q-#`W."(L(D%55$]314Y$("`B+")!551/4T5.1"`@(BPB
etc..
etc...
end

begin 775 results.log
M+3`U+C`S+C4S+C(Q-#`W."(L(D%55$]314Y$("`B+")!551/4T5.1"`@(BPB
etc...
etc...
end

我试图只将文件作为附件发送而根本不使用uuencode:

mail -a info.csv -a results.log -s "Info" $MAIL_RECIPIENTS

但这是在脚本中间被调用的,除非我按CTRL D,否则它将挂起。

这是我正在使用的uuencode版本:

uuencode (GNU sharutils) 4.7
Copyright (C) 1994, 1995, 1996, 2002, 2005, 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

其他人有没有经历过? 恐怕傻子是不是一种选择。

由于电子邮件的正文仍然是空的,因此我能够这样做来停止挂起等待EOT的邮件实用程序。

mail -a info.cvs -a results.log -s "Info" $MAIL_RECIPIENTS < /dev/null

您可以使用mailx发送带有正文和附件的邮件,并按以下方式使用它:

$ echo "body" | mailx -a AttachmentFile -s "subject" recipient@somewhere.com

用这个:

uuencode info.cvs info.cvs |mailx -s 'results.log' -r $ReplyAddress $MailAddress

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM