在unix脚本中发送带附件的电子邮件无法在附件中发送数据

时间:2016-08-18 05:13:24

标签: shell unix

我尝试使用unix脚本在电子邮件中发送一些附件。我可以发送带附件的电子邮件,但附件中不包含任何数据。

#!/bin/csh
mailx -s "Sample attachment email" <<EOF
`uuencode myfile.txt`
EOF

1 个答案:

答案 0 :(得分:0)

你应该用uuencode定义退出状态; 0(EXIT_SUCCESS),    1(EXIT_FAILURE)

#!/bin/csh
mailx -s "Sample attachment email" root@localhost <<EOF
`uuencode myfile.txt 0`
EOF