[英]mailx -a is not working to send html email in Solaris
我正在尝试以html格式发送电子邮件。 但它不起作用。
echo "<html><b>Hello</b></html>" | mailx -a "Content-type: text/html;" -s "Testing" me@xmple.com
返回值:
mail: illegal option -- a
mail: Usage: [-ehpPqr] [-f file] [-x debuglevel]
or [-tw] [-m message_type] [-T file] [-x debuglevel] persons
or [-x debuglevel]
但是同一命令正在使用out -a选项而不是html。
echo "<html><b>Hello</b></html>" | mailx -s "Testing" me@xmple.com
-a
是GNU版本的mailx
的文件附件。 大多数其他版本的mailx
不支持该选项,因为它们主要与基于文本的邮件有关。 要使它正常工作,您无能为力。 以下是一些选项:
如果这只是您要通过电子邮件发送的文本,只需将其重定向到mail命令:
$ mailx -s "Here's the info" bob ted alice < file.txt
在过去,我们会对该文件进行编码 。 这会将任何文件转换为所有计算机都能理解的ASCII字符的64个字符的子集。 (过去,许多计算机只有6个字节的字符,因此只有64个字符)。 您将对文件进行uuencode
,然后将其附加到电子邮件中。 收件人将保存附件并对文件进行uudecode
。
$ uuencode -o file.uuencode file.jpg file.jpg
$ mailx -s "Here's the jpg (uuencoded) bob ted alice < file.uuencode
或者,您可以使用脚本脚本语言(例如PHP,Perl或Python)来执行MIME编码的邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.