Linux 邮件命令文件附件
我想在 Linux 中使用 mail 命令发送带有文件附件的邮件。我已经尝试过:
mail [email protected] < test.txt
但是 test.txt 是作为消息发送的,而不是作为附件发送的。我不想使用 mutt 或其他类型的邮件替代品。我也不想使用 uuencode。如何从 bash 使用纯邮件命令发送文件附件?
Possible Duplicate:
How do I send a file as an email attachment using Linux command line?
I want to send a mail with file attachment in linux with mail command. I have tried this:
mail [email protected] < test.txt
but test.txt is send as message, not as a attachment. I don't want to use mutt or other types of mail alternatives. Also i DON'T want to use uuencode. How can i send a file attachment with pure mail command from bash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想使用
mail
将文件作为附件发送,则必须根据 MIME 及其多部分消息 规范>。我已经做过一次,但它并不完美,仅出于教育目的值得尝试。此外,如果您打算附加二进制文件,您将需要某种二进制到 ascii 编码器。当时我发现了一个base64编码器/解码器的C源代码,我在bash脚本中编译并使用了它。
If you want to use only
mail
for sending files as attachments, you have to write your own bash scripts for formatting the message according to MIME and its specification for multipart messages.I've done it once but it was not perfect and worth the try only for educational purpose. Moreover, if you plan to attach binary files, you will need some sort of binary to ascii encoder. At that time I found the C source code of a base64 encoder/decoder that I compiled and used in my bash scripts.