[英]mailx -a is not working to send html email in Solaris
I am trying to sending an email in html format. 我正在尝试以html格式发送电子邮件。 but its not working.
但它不起作用。
echo "<html><b>Hello</b></html>" | mailx -a "Content-type: text/html;" -s "Testing" me@xmple.com
Returns : 返回值:
mail: illegal option -- a
mail: Usage: [-ehpPqr] [-f file] [-x debuglevel]
or [-tw] [-m message_type] [-T file] [-x debuglevel] persons
or [-x debuglevel]
but the same command is working with out -a option which is not a html. 但是同一命令正在使用out -a选项而不是html。
echo "<html><b>Hello</b></html>" | mailx -s "Testing" me@xmple.com
The -a
is a file attachment in the GNU version of mailx
. -a
是GNU版本的mailx
的文件附件。 Most other versions of mailx
don't support that option since they're mainly concerned with text-based mail. 大多数其他版本的
mailx
不支持该选项,因为它们主要与基于文本的邮件有关。 There is not much you can do to get this to work. 要使它正常工作,您无能为力。 Here are some options:
以下是一些选项:
If this is merely text you want to email, simply redirect it to the mail command: 如果这只是您要通过电子邮件发送的文本,只需将其重定向到mail命令:
$ mailx -s "Here's the info" bob ted alice < file.txt
In the old days, we would uuencode the file. 在过去,我们会对该文件进行编码 。 This would convert any file to a 64 character subset of ASCII characters that all computers understood.
这会将任何文件转换为所有计算机都能理解的ASCII字符的64个字符的子集。 (Many computers in the old days only had 6-byte characters, thus 64 characters).
(过去,许多计算机只有6个字节的字符,因此只有64个字符)。 You would
uuencode
the file, then attach it to the email. 您将对文件进行
uuencode
,然后将其附加到电子邮件中。 The recipient would save the attachment and uudecode
the file. 收件人将保存附件并对文件进行
uudecode
。
$ uuencode -o file.uuencode file.jpg file.jpg
$ mailx -s "Here's the jpg (uuencoded) bob ted alice < file.uuencode
Or, you can use a scripting language like PHP, Perl, or Python that can do MIME encoded mail. 或者,您可以使用脚本脚本语言(例如PHP,Perl或Python)来执行MIME编码的邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.