任何人有一个试用?
Sendmail的据说是不可扩展,但它是免费的,所以我决定先用它现在:)
Answer 1:
我不能让任何发布的解决方案的工作,但最后发现这在其他地方,和它的伟大工程:
(
echo "From: ${from}";
echo "To: ${to}";
echo "Subject: ${subject}";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "${message}";
) | sendmail -t
Answer 2:
如果我理解正确的话,你想使用Linux sendmail命令以HTML格式发送邮件。 此代码工作在Unix。 请试一试。
echo "From: me@xyz.com
To: them@xyz.com
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary='PAA08673.1018277622/server.xyz.com'
Subject: Test HTML e-mail.
This is a MIME-encapsulated message
--PAA08673.1018277622/server.xyz.com
Content-Type: text/html
HTML E-mail--PAA08673.1018277622/server.xyz.com
" | sendmail -t
对于sendmail配置的详细信息,请参阅此链接 。 希望这可以帮助。
Answer 3:
This page should help - http://www.zedwood.com/article/103/bash-send-mail-with-an-attachment
It includes a script to send e-mail with a MIME attachment, ie with a HTML page and images included.
Answer 4:
我明白你问的sendmail,但为什么不使用默认的邮件 ? 它可以轻松地发送HTML格式的电子邮件。
适用于:RHEL 5.10 / 6.x中和的CentOS 5.8
例:
cat ~/campaigns/release-status.html | mail -s "$(echo -e "Release Status [Green]\nContent-Type: text/html")" to.address@company.com -v
代码共享: http://www.codeshare.io/8udx5
Answer 5:
要使用跟进以前的答案邮件 :
很多时候,一个人的HTML输出是由客户端邮件程序,这可能不是格式化使用固定宽度的字体事物解释。 因此,你的很好的格式化的ASCII Alignment获取全乱了。 送老式的固定宽度的上帝希望的方式,试试这个:
{ echo -e "
"
echo "Descriptive text here."
shell_command_1_here
another_shell_command
cat <
This is the ending text.