linux shell发送带附件的邮件

如果没有正文文件的话,就用echo直接把正文打出来就行了,如:

echo "this is content" | mutt -s "this is subject" -a /path/yourfile abc@local.domain -c bbb@local.domain

如果有正文文件的话就用

cat /path/contentfile  | mutt -s "this is subject" -a /path/yourfile abc@local.domain -c bbb@local.domain

mutt是linux下一个强大的邮件客户端软件.

-s是主题

-a是附件

-c是抄送,多个抄送就是多个-c,如

cat /path/contentfile  | mutt -s "this is subject" -a /path/yourfile abc@local.domain -c bbb@local.domain -c ccc@local.domain -c ddd@local.domain

如果发送多个email,就直接列出来就行了,如

cat /path/contentfile  | mutt -s "this is subject" -a /path/yourfile abc@local.domain  bbb@local.domain ccc@local.domain ddd@local.domain

原文地址:https://www.cnblogs.com/pony/p/1006050.html