我正在尝试以html格式发送电子邮件。
var sdp = client.SdpParser.parse(answer.sdp);
sdp.media.forEach(function(media){
if(media.type === 'video' && media.inactive ) {
delete media.fingerprint;
media.port = 0;
}
});
answer.sdp = client.SdpParser.format(sdp);
我正在接收电子邮件,但html标签和内容类型也会在邮件中显示如下。
主题为
#!/bin/sh
#MAIL_LIST="gangadhar.n@xx.com"
MAIL_SENDER=foo
fnSendEmail(){
echo ${BODY}| mail -r $MAIL_SENDER -s "$(echo "$MAIL_SUBJECT\nContent-Type: text/html")" "$MAIL_LIST"
}
MAIL_SUBJECT="Test email"
BODY="<html><body><div><h2>Hi All</h2><hr></div></body></html>";
fnSendEmail $BODY $MAIL_SENDER $MAIL_SUBJECT $MAIL_LIST
电子邮件正文:
"Test email\nContent-Type: text/html"
提前谢谢
答案 0 :(得分:0)
使用选项-a附加内容类型标题,-s是主题,将fnSendEmail更改为跟随它应该工作
fnSendEmail(){
echo ${BODY}| mail -r $MAIL_SENDER -a "Content-type: text/html" -s "$(echo "$MAIL_SUBJECT\n")" "$MAIL_LIST"
}
答案 1 :(得分:0)
我使用sendmail
完成了它#MAIL_LIST1="Gangadhar.N@xx.com"
MAIL_SENDER=dap
fnSendEmail(){
(
echo To: $MAIL_LIST
echo Cc: $MAIL_LIST
echo From: dap53
echo "Content-Type: text/html; "
echo Subject: $MAIL_SUBJECT
echo
echo $BODY
) | /usr/sbin/sendmail -t
}
MAIL_SUBJECT="Test email"
BODY="<html><body>Sample</body></html>"
fnSendEmail $BODY $MAIL_SENDER $MAIL_SUBJECT $MAIL_LIST