阿使得肌肤· 发表于 2015-11-25 13:41:05

sendmail 发送html 的邮件

1. 启动sendmail 的进程

sudo /etc/init.d/sendmail start
ps aux|grep sendmail

2. 组装html的文件

Subject: title-testing
From: zengtai.csm@xxx.com
To: zengtai.csm@xxx.com
Cc: zengtai.csm@xxx.com
MIME-VERSION: 1.0
Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"
--GvXjxJ+pjyke8COw
Content-type: text/html; charset=gb2312#设置编码后中文还是乱码
Content-Transfer-Encoding: 7bit
<html>
<body>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; bgcolor=&quot;black&quot;>
<tr>
<th bgcolor=&quot;#66ffff&quot;>data table name</th>
<th bgcolor=&quot;#66ffff&quot;>data table size</th>
<th bgcolor=&quot;#66ffff&quot;>data table time</th>
</tr>
<tr>
<th bgcolor=&quot;white&quot;>data_index</th>
<th bgcolor=&quot;white&quot;>2048M</th>
<th bgcolor=&quot;white&quot;>20150806</th>
</tr>
</table>
</body>
</html>



3. sendmail 发送命令

cat t.txt|sendmail -t -F zengtai.csm@xxx.com

4. python 用smtplib 发送邮件, smtp_server&quot;127.0.0.1&quot;

但是发布出去,那首先要看看看此台机器是否启动了smtp的服务,也就是25端口是否是okd
netstat -lan|grep 25
tcp      0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN

5. sendmail 的smtp的服务配置文件
rpm -qf /etc/init.d/sendmail
sendmail-8.13.8-8.1.rpm
/etc/mail/sendmail.mc
页: [1]
查看完整版本: sendmail 发送html 的邮件