使用uuencode将多个附件从变量附加到电子邮件并使用sendmail发送 [英] Using uuencode to attach multiple attachments from a variable to an e-mail and send using sendmail

查看:66
本文介绍了使用uuencode将多个附件从变量附加到电子邮件并使用sendmail发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目前正在执行的脚本:

I have a script that currently does:

cat $body | uuencode $attachment $attachment | sendmail $sender -t

我应该调整什么,以便$ attachment可以是多个附件?我想出了以下内容,但看起来不正确吗?

What should I adjust so that $attachment could be multiple attachments? I have come up with the below but it doesn't look correct?

cat $body |
for i in $attachments 
do
uuencode $i $i
done
| sendmail $sender -t

推荐答案

FILES ="/rollovers/DailyCadRpt.*/rollovers/DailyFireRpt.*"

FILES="/rollovers/DailyCadRpt.* /rollovers/DailyFireRpt.*"

(对于$ FILES中的f;执行uuencode"$ f""$ f";完成)|邮件-s主题"收件人_email@domain.com

(for f in $FILES ; do uuencode "$f" "$f" ; done ) | mail -s "Subject" recipient_email@domain.com

以上内容在AIX 6.1中适用于通配符.但是,您必须使用10填充星号.数字8上方的星号在AIX中不起作用.另外,它没有任何正文.但这与其他示例相同.在我的示例中,您可以使用空格作为分隔符来添加更多文件.另外,您不能将Daily *与星号一起使用.AIX不会这样做.文件名中的星号必须在句点之后.我们的报告将日期添加到报告名称中,并用句点分隔.它保留了我们的存档命名模式,并每天都在不需要特定文件名的情况下进行抓取.

The above works in AIX 6.1 for wildcards. But, you must use the 10-pad asterisk. The asterisk above the number eight does not work in AIX. Also, this does not have any body text. But that is done as in the other examples. You may add more files by using a space as the separator, as in my example. Also, you cannot use Daily* with either asterisk. AIX just won't do it. The asterisk must come after a period in the file name. Our reports have the date added to the report name separated by a period. It preserves our archival naming pattern and grabs it every day without needing a specific file name.

这篇关于使用uuencode将多个附件从变量附加到电子邮件并使用sendmail发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆