Linux 邮件命令文件附件

发布于 2024-12-22 02:13:13 字数 549 浏览 5 评论 0原文

可能的重复:
如何发送使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难忘№最初的完美 2024-12-29 02:13:13

如果您只想使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文