如果您使用Solaris而无需额外安装的软件发送MIME邮件:如何使用标准命令行工具发送带有MIME附件的邮件?
您可以在shell脚本中使用以下片段。 这确实是一个非常丑陋的黑客攻击,所以请仅使用这个不重要的事情。 我认为它可能会在文件的末尾添加一个或两个字节,否则它似乎工作正常。
mail ${mailinglist} << END_MAIL To: ${mailinglist} From: ${mailsender} Subject: ${subject} Content-Type: multipart/mixed; boundary="_NextPart_" Content-Type: text/plain; charset=us-ascii This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --_NextPart_ Hallo, here is whatever.zip. --_NextPart_ Content-Type: application/x-zip-compressed; name="whatever.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="whatever.zip" ` uuencode whatever.zip whatever.zip | sed -e 's/^end$/~~~/' | tail +2 | cut -c 2- | tr ' !"#$%&\047()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\133\134\135^_' \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | sed -e 's/^~~$/==/' ` --_NextPart_-- END_MAIL