如何通过 mailx 发送带有随附文件的电子邮件
我需要通过 mailx 或邮件发送文件,但我希望将其作为附件发送,而不是在正文中发送。有什么办法可以做到吗? 最终,solaris 中还有其他工具可用于此类程序吗? 谢谢
I need to sent a file via mailx or mail, but I wat to sent it as attachment not in the body message. Is there any way how to do it ?
Eventually is there any other tool in solaris which can be used for such as procedure ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 -a 将文件附加到 mailx,只要
您的附件与附件位于同一目录中,就可以正常工作。如果没有,您可以只指定目录,例如`
You can attach files to mailx using -a like so
so long as your in the same directory as your attachment that should work fine. If not you can just state the directory like `
如果您的
mailx
不支持-a
选项,并且您无权访问mutt
,并且您不想转向到uuencode
作为 20 世纪 80 年代的后备,作为最后的手段,你可以拼凑一个小的 MIME 包装你自己。sendmail
的路径通常取决于系统。尝试/usr/sbin/sendmail
或/usr/lib/sendmail
或...无数其他奇怪的地方(如果它不在您的PATH
中) 。这又快又脏;为了正确遵守 MIME,您应该在必要时对主题进行 RFC2047 编码等,另请参阅代码中注释中的注释。但对于一般以美国为中心的 7 位英语 cron 作业来说,它就足够了。
If your
mailx
doesn't support the-a
option and you don't have access tomutt
, and you don't want to turn touuencode
as a fallback from the 1980s, as a last resort you can piece together a small MIME wrapper yourself.The path to
sendmail
is often system-dependent. Try/usr/sbin/sendmail
or/usr/lib/sendmail
or ... a myriad other weird places if it's not in yourPATH
.This is quick and dirty; for proper MIME compliance, you should do RFC2047 encoding of the subject if necessary, etc, and see also the notes in the comments in the code. But for your average US-centric 7-bit English-language cron job, it will do just fine.
关于mailx,你可以在这里找到一些灵感
http://www.shelldorado.com/articles/mailattachments.html
我会推荐你看看杂种狗
http://www.mutt.org/
Regarding mailx, you can find some inspiration here
http://www.shelldorado.com/articles/mailattachments.html
I would recommend you to have a look at mutt
http://www.mutt.org/
尝试使用此命令以使用 Mailx 发送附件:
Try using this command in order to send an attachment using Mailx:
我建议使用
mutt
< /a> ,它足够轻量,可以快速安装在任何系统上。I'd recommend using
mutt
for it, which is light-weight enough to quickly install on any system.