[KSH]如何使用shell脚本创建html邮件?

时间:2013-04-30 12:40:43

标签: html email ksh

我需要使用ksh语言,创建一个转发电子邮件的脚本,在主体中包含html内容,你能帮我一个教程,还是一个简单的脚本示例?

提前致谢。

1 个答案:

答案 0 :(得分:1)

http://unixnair.blogspot.com.au/2011/09/how-to-send-email-with-html-formatting.html

#!/usr/bin/ksh
# Script to send html email
# Written by Madhu

FROM="madhu@tarikida.com"
TO="madhu@tarikida.com"
SUBJECT="This email has html contents"
CONTENTS="/home/madhu/scripts/mail_text.html"
HEADER="From: ${FROM}                             \
\nTo: ${TO}                                     \
\nSubject: \"$SUBJECT\"                              \
\nContent-Type: text/html; charset=us-ascii   \
\nContent-Transfer-Encoding: 7bit                  \
\nMIME-Version: 1.0"
#echo $HEADER;
( echo $HEADER; cat $CONTENTS ) | /usr/sbin/sendmail -t