通过以下python代码通过mailgun发送电子邮件会导致收件人在ms-outlook中看到不需要的“断链”图标(在附图中以黄色突出显示)。如何避免这种情况?
代码如下:
def send_integration_notification_staging(sync_date, email_arg):
## sync_date is passed in as "2017-09-27"
## a valid email adddress is passed in to email_arg
rptfn = runPath+"/rpt/post_processing_summary_" + sync_date + ".rpt"
with open(rptfn, 'r') as rptfile:
rptcontent=rptfile.read()
dfn1="student_rec_err_" + sync_date + ".csv"
dfn2="parent_rec_err_" + sync_date + ".csv"
dfn3="staff_rec_err_" + sync_date + ".csv"
return requests.post(
"https://api.mailgun.net/v3/mystaging.mydomain.com/messages",
auth=("api", "key-<blah blah..values deleted>"),
files=[("attachment",(dfn1, open(runPath+'/rpt/'+dfn1, "r"))),
("attachment",(dfn2, open(runPath+'/rpt/'+dfn2, "r"))),
("attachment",(dfn3, open(runPath+'/rpt/'+dfn3, "r")))],
data={"from": "Administrator <admin@mydomain.com>",
"to": [email_arg],
"subject": "Integration Notification - Post Processing: " + sync_date, "html": rptcontent})
文件的示例内容post_processing_summary_20170927.rpt:
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
Post processing report for 20170927:
<p><p>
<table>
<tr><th>SyncDate</th> <th>Status</th> <th>NumRecords</th></tr>
<tr><td>2017-09-27</td> <td>STUDENTS - INVALID INFO</td> <td>291</td></tr>
<tr><td>2017-09-27</td> <td>STUDENTS - JOINING CENTRE/CLASS</td> <td>55033</td></tr>
<tr><td>2017-09-27</td> <td>STUDENTS - LEAVING CENTRE/CLASS</td> <td>235</td></tr>
<tr><td>2017-09-27</td> <td>STUDENTS - PENDING PROCESSING</td> <td>2</td></tr>
<tr><td>2017-09-27</td> <td>STUDENTS - RECORD IN SYNC</td> <td>8547</td></tr>
<tr><td>2017-09-27</td> <td>PARENTS - AMENDED INFO</td> <td>12060</td></tr>
<tr><td>2017-09-27</td> <td>PARENTS - INVALID INFO</td> <td>809</td></tr>
<tr><td>2017-09-27</td> <td>PARENTS - NEWLY ADDED</td> <td>55643</td></tr>
<tr><td>2017-09-27</td> <td>PARENTS - RECORD IN SYNC</td> <td>1387</td></tr>
<tr><td>2017-09-27</td> <td>STAFF - INVALID INFO</td> <td>373</td></tr>
<tr><td>2017-09-27</td> <td>STAFF - JOINING CENTRE</td> <td>2604</td></tr>
<tr><td>2017-09-27</td> <td>STAFF - RECORD IN SYNC</td> <td>1709</td></tr>
</table>
Please find attached the details of the various invalid Records