Python:脚本发送的邮件被Gmail标记为垃圾邮件 [英] Python: Mail sent by script is marked as spam by Gmail

查看:167
本文介绍了Python:脚本发送的邮件被Gmail标记为垃圾邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个python脚本,每天发送邮件到xml地址列表。这些邮件总是被Gmail标记为垃圾邮件。这是代码:

We have a python script that sends mails everyday to an xml list of addresses. Those mails are always marked as spam by Gmail. Here's the code:

            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>Tr@ces</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', 'readers@traces.net'))
            msg['From'] = email.utils.formataddr(('Traces', 'traces@anemailstory.net'))
            msg['Subject'] = 'Tr@ces - 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('traces@noreply.net', email_addrs, msg.as_string())
            finally:
                server.quit()

这是生成的电子邮件:

Return-path: <traces@noreply.net>
Envelope-to: mimmo@mimmo.com
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 <traces@noreply.net>)
    id 1SNHjO-0006T0-C2; Wed, 25 Apr 2012 23:59:06 -0600
Content-Type: multipart/alternative;
    boundary="===============1468314745133566460=="
MIME-Version: 1.0
To: Recipient <readers@traces.net>
From: Traces <traces@anemailstory.net>
Subject: Tr@ces - 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>Tr@ces</i></a><br/><br/> - <br/><br/><a href="http://anemailstory.net/unsubscribe.html">unsubscribe</a><br/><br/></div></body></html>
--===============1468314745133566460==--

您有解决方案吗?

谢谢。

推荐答案

您的电子邮件几乎只包含HTML和链接。

You email consists of almost only HTML and a link. That smells like spam.

建议:


  • 发送明文电子邮件(较少可能被认为是垃圾邮件 - 对于许多用户而言更为舒适)

  • 如果您使用HTML,请始终包含明文版本

  • 改进文本转换-links / html比例。

这篇关于Python:脚本发送的邮件被Gmail标记为垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆