0%

CENTOS下使用sendmail发送html邮件

利用sendmail发送带html格式的邮件

安装

1
2
3
yum -y install sendmail
chkconfig sendmail on
service sendmail start

测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cat > mail.txt << EOF
From: kingwen@msn.com
To: aaaa@qq.com
Content-type: text/html;charset=UTF-8
Subject: test
<style type="text/css">
.container div{ width: 300px; margin: 5px; border-style: solid; border-width: 0px; float: left; }
.container img{ width: 300px; height: auto; }
.container p{ text-align: center; margin: 0px; font-size: 20px; font-style: italic; }
</style>
<div class="container">
<div>
<a href="https://item.taobao.com/item.htm?id=529495434637">
<img src="https://gd4.alicdn.com/bao/uploaded/i4/TB1r.e5LVXXXXXDXpXXXXXXXXXX_!!0-item_pic.jpg" alt="活动爆款2016最新短袖A字连衣裙潮流精品个性">
</a>
<p>活动爆款2016最新短袖A字连衣裙潮流精品个性</p>
</div>
</div>
EOF
cat mail.txt | sendmail -t

参考文档

  1. http://www.linux521.com/2009/system/201206/18170.html