gpt4 book ai didi

Python:脚本发送的邮件被 Gmail 标记为垃圾邮件

转载 作者:太空宇宙 更新时间:2023-11-03 12:50:29 25 4
gpt4 key购买 nike

我们有一个 python 脚本,每天将邮件发送到 xml 地址列表。这些邮件总是被 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>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 和一个链接。这闻起来像垃圾邮件。

建议:

  • 发送纯文本电子邮件(不太可能被视为垃圾邮件 - 并且对许多用户来说更舒适)
  • 如果您使用 HTML,请始终包含纯文本版本
  • 提高文本与链接/html 的比率。

关于Python:脚本发送的邮件被 Gmail 标记为垃圾邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10445528/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com