我使用sendmail将以下电子邮件发送到收据。奇怪的是,一旦收到html标签之一就被替换了。因此,该表看起来很荒谬。
有人知道发生了什么吗?
使用的命令:
sendmail -t -f "test_mail@${HOSTNAME}" < /tmp/test_mail
更新: 通过在每个html标记的末尾添加换行符,可以解决此问题,但是为什么呢?
/ tmp / test_mail的内容
to: xxx.xxx@outlook.com
subject: CRITICAL: xhhmy92856 (xhhmy92856)
mime-version: 1.0
Content-Type: text/html; charset="UTF-8"
<style>
td, th {
border: 1px solid #ccc;
text-align: left;
font-family: calibri;
}
th {
text-align: center;
background: gray;
border-color: white;
font-family: calibri;
color: white;
}
p { font-family: calibri; }
</style>
<p>Environment statistics results, Date Fri Oct 12 13:10:22 AEDT 2018:</p>
<p>The following <b><font color=red>CRITICAL</font></b> issues were found on the environment statistics results:</p>
<table>
<tr><th>Group</th><th>Critical Status</th></tr>
<tr><td> (DB_5M_tables_row_count_check)</td><td>Library <b></b><br>Table <b>CIS_IPNE_CPU_5M</b><br>Less <b>IP_NEs</b> reported for some states in the last hour: <table><tr><th>Date Time</th><th>State</th><th>Previous</th><th>Current</th><th>Missing NEs</th></tr><tr><td>20181012.0745</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0750</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0755</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0800</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0805</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0810</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0815</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0820</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0825</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0830</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0835</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0840</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr></table><br><b>Action:</b>TEOCO, please check the GD Access Logs for further information. Identify first the NE, then the GD and just then look for timeouts or errors. (This check will be automatic soon)</b></td></tr>
</table>
<br><p>All checks are done.</p>
收到的内容:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>
td, th {
border: 1px solid #ccc;
text-align: left;
font-family: calibri;
}
th {
text-align: center;
background: gray;
border-color: white;
font-family: calibri;
color: white;
}
p { font-family: calibri; }
</style>
<p>Environment statistics results, Date Fri Oct 12 13:10:22 AEDT 2018:</p>
<p>The following <b><font color="red">CRITICAL</font></b> issues were found on the environment statistics results:</p>
<table>
<tr><th>Group</th><th>Critical Status</th></tr>
<tr><td> (DB_5M_tables_row_count_check)</td><td>Library <b></b><br>Table <b>CIS_IPNE_CPU_5M</b><br>Less <b>IP_NEs</b> reported for some states in the last hour: <table><tr><th>Date Time</th><th>State</th><th>Previous</th><th>Current</th><th>Missing NEs</th></tr><tr><td>20181012.0745</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0750</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0755</td><td>NT</td><td>10</td>
<td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0800</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0805</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.
0810</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0815</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0820</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></ta></td></tr><tr><td>20181012.0825</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0830</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0835</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3
</td><td>TimeOut.</td></tr></table></td></tr><tr><td>20181012.0840</td><td>NT</td><td>10</td><td>8</td><td><table><tr><th>NE</th><th>Access ID</th><th>GD Name</th><th>Error Text</th></tr><tr><td>RENUIC0001</td><td>1214</td><td>GD_SNMP_COMMNAD_19_MED3</td><td>TimeOut.</td></tr><tr><td>RENUIC0002</td><td>1249</td><td>GD_SNMP_COMMAND_13_MED3</td><td>TimeOut.</td></tr></table></td></tr></table><br><b>Action:</b>TEOCO, please check the GD Access Logs for further information. Identify first the NE, then the GD and just then look for timeouts or errors. (This check will be automatic soon)</b></td></tr>
</table>
<br><p>All checks are done.</p>
更新: 通过在每个html标记的末尾添加换行符,可以解决此问题,但是为什么呢???????
sed 's/table>/table>\n/g; s/tr>/tr>\n/g; s#</td>#</td>\n#g; s#</th># </th>\n#g' /tmp/test_mail
答案 0 :(得分:1)
Sendmail(由sendmail.org提供)中断了电子邮件中的长行。其他MTA / SMTP服务器的行为可能类似。 Sendmail限制为每行990字节。
在您的情况下,最长的4560字节行已被分成991、991、1977、604字节行。
请勿在HTML模板中使用长行
或
通过tidy
(html格式化程序)传递生成的html
或
将邮件正文编码为带引号的可打印内容(它会处理过长的行)
这将需要一些额外的标题
带引号的可打印编码对于几乎 ASCII字符集(通常是ASCII /美国英语加上一些额外的/特殊的字母)也很方便
4.5.3.1.6。文字行
包括
<CRLF>
的文本行的最大总长度为1000 八位字节(不计算透明度重复的前导点)。 可以通过使用SMTP服务扩展来增加此数字。