0

I needed to create a daily (automatic) email with information about a service I am using. I wrote a Java program that gathers information from that service and puts it into a .xls file. This Java program also prints diagnostic information to STDERR.

I would like to email the .xls file as an attachment and have the diagnostic information in the email body. How can I get this information in the email through the command-line?

4

2 回答 2

2

mail/mailx不支持附件。如果您需要附件,请安装mutt

mutt -s Subject -a file send@to

但它只能附加一个文件。一种解决方法是stderr作为邮件正文发送:

mutt -s Subject -a info.xls send@to < logfile
于 2012-08-27T15:50:13.680 回答
0

如果你在 Unix 上,你可以检查 ff 命令行实用程序:

  1. 邮件
  2. 邮箱

这些实用程序需要 SMTP 服务器来实际传递消息

更多信息(带附件发送)在这里:

http://www.cyberciti.biz/faq/howto-unix-sending-files-as-mail-attachments/

于 2012-08-27T15:45:32.133 回答