5

我们的生产服务器已经退役,现在我们使用的是运行 Redhat GNU/Linux 的托管系统。

我们有许多使用 mutt 发送文件附件的脚本,但它们现在失败了,因为我们的服务器上没有安装 mutt(系统管理员策略是 mutt 不安全,因此不会安装)

我曾尝试使用mailx,但无济于事。当我做

echo "this is my email body"| mailx -s "this is my email subject" "email@xyz.com" -a "filename.csv"

我明白了

$ send-mail: illegal option -- a

“filename.csv”存在,它在我运行命令的目录中是本地的。当然,当我这样做时

mailx -s "this is my email subject" "email@xyz.com" < "filename.csv"

它可以工作,但它将文件附件嵌入到电子邮件正文中。用户不希望这样。

我究竟做错了什么?

4

2 回答 2

5

我想到了。我只是像这样在电子邮件地址之前移动了 -a 标志

echo "this is my email body"| mailx -s "this is my email subject" -a "filename.csv" "email@xyz.com"

它工作得很好。

于 2015-02-24T19:26:48.610 回答
0
uuencode filename.csv filename.csv | mailx -s "this is my email subject" "email@xyz.com"

或者,如果您想将文本和附件聚集在一起,那么

echo "this is my email body" | cat -<(echo uuencode filename.csv filename.csv) | mailx -s "this is my email subject" "email@xyz.com"
于 2021-07-13T03:19:20.477 回答