sendmail 发送html 的邮件

1. 启动sendmail 的进程

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

2. 组装html的文件

Subject: title-testing
From: [email protected]
To: [email protected]
Cc: [email protected]
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="0" cellpadding="0" cellspacing="1" bgcolor="black">
<tr>
    <th bgcolor="#66ffff">data table name</th>
    <th bgcolor="#66ffff">data table size</th>
    <th bgcolor="#66ffff">data table time</th>
</tr>
<tr>
    <th bgcolor="white">data_index</th>
    <th bgcolor="white">2048M</th>
    <th bgcolor="white">20150806</th>
</tr>
</table>
</body>
</html>


3. sendmail 发送命令

cat t.txt|sendmail -t -F [email protected]

4. python 用smtplib 发送邮件, smtp_server"127.0.0.1"

但是发布出去,那首先要看看看此台机器是否启动了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



你可能感兴趣的:(sendmail 发送html 的邮件)