如何使用 HP-UX shell 脚本将简单的文本文件作为附件发送?
我需要在 HP-UX 中使用 shell 脚本发送一封带有文本文件作为附件的电子邮件;我没有安装mutt。
我正在使用以下命令,但它在电子邮件正文中发送文件内容,我希望将其作为附件。
mailx -s "Report" [email protected] < file.txt
I need to send an email with a text file as attachment using shell script in HP-UX; I don't have mutt installed.
I am using following command but it sends the file content in body of email, I want it as an attachment.
mailx -s "Report" [email protected] < file.txt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
几年前我写了这个
ksh
函数I wrote this
ksh
function a few years agouuencode
是你的朋友。这是一个经过测试的示例:
uuencode
is your friend.Here is a tested example:
我遇到了同样的问题,uuencode 的输出作为邮件正文的一部分而不是作为附件发送(至少在使用 Outlook 2010 查看发送的邮件时)。我在此线程中找到了答案 http://www. unix.com/hp-ux/41306-sending-attachments-through-mailx.html
添加 -m 会导致 mailx 在发送电子邮件时不添加 MIME 标头行。 OP的命令将更改为:
mailx -m -s "Report" [电子邮件受保护] <文件.txt
I was having the same problem where the output of uuencode was being sent as part of the message body rather than as an attached file (at least when using Outlook 2010 to view the sent mail). I found the answer in this thread http://www.unix.com/hp-ux/41306-sending-attachments-through-mailx.html
Adding -m causes mailx to not add MIME header lines when sending email. The OP's command would be altered to look like:
mailx -m -s "Report" [email protected] < file.txt
几个月前我也遇到了同样的问题。
我需要的命令是 ux2dos
我希望它能有所帮助!
问候
I also encountered the same problem few months ago.
The command I needed was
ux2dos
I hope it can help !
Regards