如何使通过 Network.Mail.Mime 发送的邮件不被分类为垃圾邮件?

发布于 2024-11-03 06:43:12 字数 158 浏览 6 评论 0原文

我使用 lib Network.Mail.Mime 从我的 Haskell 程序发送电子邮件。我认为它使用 postfix 来发送电子邮件。当我尝试将邮件发送到我的 gmail 地址时,我确实收到了它们,只是它们在垃圾箱中,无论我填写“表格”填写什么,都会发生这种情况。 我怎样才能避免这种行为? 谢谢

I use lib Network.Mail.Mime to send emails from my Haskell program. I reckon it uses postfix to send the emails. When I try to send mails to my gmail address I do receive them, only they are in the junk, and this happens whatever I fill the "form" fill with.
How can I avoid this behavior?
Thx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

国粹 2024-11-10 06:43:12

mime-mail 接口将使用简单的 api 通过 sendmail 发送电子邮件:

{-# LANGUAGE OverloadedStrings #-}

import Data.Text
import Network.Mail.Mime

main = do
    simpleMail
        "[email protected]"
        "[email protected]"
        "Test"
        "This is a test"
        ""
        []

假设您正确使用 Data.Text 来避免区域设置编码问题。

现在,这可能会设置不足的标头,因此垃圾邮件过滤器会命中它。您可能需要要求 gmail 将此邮件归类为垃圾邮件,或者您可以设置更多标头,使其看起来不像假电子邮件。

The mime-mail interface will send email, via sendmail, using the simple api:

{-# LANGUAGE OverloadedStrings #-}

import Data.Text
import Network.Mail.Mime

main = do
    simpleMail
        "[email protected]"
        "[email protected]"
        "Test"
        "This is a test"
        ""
        []

assuming you're correctly using Data.Text to avoid locale encoding issues.

Now, this is likely to set insufficient headers, so the spam filter will hit it. You may need to ask gmail to not classify this as spam, or alternatively you could set more headers so it doesn't look like fake email.

予囚 2024-11-10 06:43:12

Don 关于 sendmail 和标头问题的说法是正确的。但仅邮件标头通常不足以防止邮件被标记为垃圾邮件。它可能与您的 IP 范围被列入黑名单有关,或者与您发送邮件的方法没有明确关联的任何其他因素有关。第一步是检查您正在使用的邮箱中的邮件通常是如何标记的,并根据具体情况,将 sendmail 配置为通过授权连接转发到受信任的邮件代理等。

Don is right about sendmail and the headers issue. But mail headers alone often aren't enough to prevent mail being marked as spam. It can be related to your ip range being blacklisted, or any number of other things not explicitly tied to the method by which you send mail. The first step is to check how mail from the box you're using is marked in general, and depending on the situation, to configure sendmail to forward through an authorized connection to a trusted mail agent, etc.

猫七 2024-11-10 06:43:12

就像前面提到的 sclv 一样,它可能是由许多问题引起的。

我刚刚经历了类似的磨难,spamassassin 给了我很大的帮助。我所有收到的电子邮件都通过 SpamAssassin 运行,它在标头中留下有关其使用的启发式方法的信息,或者更确切地说,哪些启发式方法失败了。如果您要发送 HTML 邮件,请确保您有足够类似的纯内容,并且您有一个正确的发件人等。

我向自己发送了一封与 Don Stewart 类似的邮件,这些是 spamassassin 标头:

X-Spam-Status: No, score=1.1 required=5.0
        tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,
        FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_RP_RNBL,RFC_ABUSE_POST
,SPF_NEUTRAL,
        T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2-r929478

可能并非所有这些都适用适合你的情况,但它可能会给出一些提示。尝试用谷歌搜索这些启发式方法。

Like sclv mentioned already, it can be caused by many issues.

I just went through a similar ordeal, and spamassassin was a great help. All my incoming email is ran through SpamAssassin which leaves information in headers about the heuristics it used, or rather which heuristics failed. If you're sending HTML-mail, make sure you have similar enough plain content, and that you have a proper sender etc.

I sent a similar mail as Don Stewart to myself and these are the spamassassin headers:

X-Spam-Status: No, score=1.1 required=5.0
        tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,
        FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_RP_RNBL,RFC_ABUSE_POST
,SPF_NEUTRAL,
        T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2-r929478

Probably not all of them apply to your case, but it might give some hint. Try googling those heuristics.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文