2014-10-09 98 views
0

我在远程服务器上工作我想将一些HTML上下文管道显示到电子邮件中。如下如何将HTML嵌入到电子邮件中

| mail -s "subject" [email protected] 

然而,当我收到的电子邮件在我的收件箱我一直在使用它,我收到了原始的HTML

?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<!-- This file was created with the aha Ansi HTML Adapter. http://ziz.delphigl.com/tool_aha.php --> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" /> 
<title>stdin</title> 
</head> 
<body> 

如何我收到一封电子邮件显示HTML命令,而不是在原始格式。

干杯

回答

1

您需要的MIME头添加到您的电子邮件声明,身体是不是text/plain的。最简便的方式来产生原始电子邮件自己和喂它sendmail程序(“为sendmail /后缀/进出口的sendmail/...)

#!/bin/sh 
[email protected] 

# feed "here document" and STDIN to sendmail 
(cat <<END; cat -) | /usr/sbin/sendmail -i $TO 
Subject: SUBJECT 
To: $TO 
MIME-Version: 1.0 
Content-Type: text/html; charset=utf-8 
Content-Transfer-Encoding: 8bit 

END 
+0

TY为响应我结束了,我可以用狗去只需将Content-type作为标题即可。 – Will 2014-10-11 04:01:32

+0

如果您不需要更多自定义标题,这可能是一个不错的选择。 – AnFi 2014-10-11 07:37:53

相关问题