0

我需要使用 ksh 语言来创建一个脚本来转发电子邮件,正文中包含 html 内容,你能帮我提供一个教程或一个简单的示例脚本吗?

提前致谢。

4

1 回答 1

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
于 2013-04-30T12:47:10.457 回答