简体   繁体   English

Unix,未附加电子邮件附件

[英]unix, email attachment not being attached

I am trying to send an attachment via a script and the logic works if i run manually but not as part of the script. 我正在尝试通过脚本发送附件,并且如果我手动运行而不是作为脚本的一部分运行,则逻辑工作正常。 if I add echo, the email goes out and populates with uuencode jef20.txt jef20.txt but no attachment. 如果添加回显,则电子邮件将消失,并使用uuencode jef20.txt jef20.txt填充,但没有附件。 any ideas? 有任何想法吗?

#!/bin/bash
echo Your Username?
read user
echo FIX Session?
read session
echo what client?
read client
awk '!/35=0|35=A|35=5|35=2|35=1|closed/'  /company/gate/app_phoenix/logs/fix/$session >> /home/dnash/$client.txt
uuencode $client.txt $client.txt | mailx -s "Cert Logs" "$user@company.com"

Depending on your version of mailx , you can use the -a ( "attach" ) command line switch: 根据mailx的版本,可以使用-a (“ attach”)命令行开关:

mailx -a "$client.txt" -s "Cert Logs" "$user@company.com"

See Also 也可以看看

mailx manpage mailx联机帮助页

how to send an email via mailx with enclosed file 如何通过带有附件的mailx发送电子邮件

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

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