我們有一個python腳本,每天都會將郵件發送到xml地址列表。這些郵件總是被Gmail標記爲垃圾郵件。下面的代碼:Python:腳本發送的郵件被Gmail標記爲垃圾郵件
email_body = '<html><body><div style="text-align: center; font-family: serif; font-size: 15px;"><br/><br/>@<br/><br/>' + text_splited[i] + '<br/><br/>@<br/><br/><a href="http://anemailstory.net/"><i>[email protected]</i></a><br/><br/> - <br/><br/><a href="http://anemailstory.net/unsubscribe.html">unsubscribe</a><br/><br/></div></body></html>'
#text corresponding to that subcription date
# email
msg = MIMEMultipart('alternative') #Create Multipart msg (allows html)
msg['To'] = email.utils.formataddr(('Recipient', '[email protected]'))
msg['From'] = email.utils.formataddr(('Traces', '[email protected]'))
msg['Subject'] = '[email protected] - Part #' + str((i+2))
part_html = MIMEText(email_body, 'html')
msg.attach(part_html)
server = smtplib.SMTP('localhost')
server.set_debuglevel(False) # show communication with the server
try:
server.sendmail('[email protected]', email_addrs, msg.as_string())
finally:
server.quit()
而這裏的生成的電子郵件:
Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Wed, 25 Apr 2012 23:59:07 -0600
Received: from localhost ([127.0.0.1] helo=host131.hostmonster.com)
by host131.hostmonster.com with esmtp (Exim 4.76)
(envelope-from <[email protected]>)
id 1SNHjO-0006T0-C2; Wed, 25 Apr 2012 23:59:06 -0600
Content-Type: multipart/alternative;
boundary="===============1468314745133566460=="
MIME-Version: 1.0
To: Recipient <[email protected]>
From: Traces <[email protected]>
Subject: [email protected] - Part #9
X-Identified-User: {:host131.hostmonster.com:andrecas:host131.hostmonster.com} {sentby:program running on server}
--===============1468314745133566460==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
<html><body><div style="text-align: center; font-family: serif; font-size: 15px;"><br/><br/>@<br/><br/><br/>Mail content<br/><br/><br/>@<br/><br/><a href="http://anemailstory.net/"><i>[email protected]</i></a><br/><br/> - <br/><br/><a href="http://anemailstory.net/unsubscribe.html">unsubscribe</a><br/><br/></div></body></html>
--===============1468314745133566460==--
你有這方面的任何解決方案?
謝謝。