Why my email goes to spam?

557 views
Skip to first unread message

Mohammad Etemaddar

unread,
Apr 18, 2019, 4:05:23 AM4/18/19
to Django users
Hello. I'm working on a bussiness website. I send invitation and also confirm emails by django-allauth.
Invitation and allauth emails go to spam box.
I don't know what is the problem?
How can I prevent emails going to spam?

Kasper Laudrup

unread,
Apr 18, 2019, 5:44:30 AM4/18/19
to django...@googlegroups.com
Hi Mohammad,
This is hardly related to Django, but anyway...

There is really no standard way to detect spam, for good reasons, so it
really depends on the mail server receiving the mail.

The first thing I would do would be to look at the headers for the mail
flagged as spam. Some spam scanners (eg. spamassasin) sets some
additional headers with scores it has used to determine the mail is
spam. You could use that to see what might be the cause for this mail
being flagged as spam.

It could be something as simple as the mail only having HTML content
which is not only a violation of the RFC but also one of the seven
deadly sins :-)

Apart from that, you should ensure that the host you are using to send
the mail is configured correctly. That potentially requires messing a
lot around with mail server configuration. Specifically, you should look
into things like DKIM, SPF and DMARC.

Also, make sure that the host sending the mail has a static IP. I know
that some mail servers (eg. hotmail/outlook365/whatever it's called
these days) always flags mail sent from a dynamic IP as spam, so make
sure you can get a static IP from your hosting provider (or change your
hosting provider to someone who will give you that).

If you can provide the full content (including all headers) of the mail
being flagged as spam, feel free to post it and I'll try to have a look.

Hope that helps a bit.

Kind regards,

Kasper Laudrup

Mohammad Etemaddar

unread,
Apr 20, 2019, 2:47:01 AM4/20/19
to Django users
Here it is:

********************

Delivered-To: arash.e...@gmail.com
Received: by 2002:ab3:7117:0:0:0:0:0 with SMTP id n23csp431925lte;
        Thu, 18 Apr 2019 01:23:17 -0700 (PDT)
X-Google-Smtp-Source: APXvYqzQO4QTZZjxmg7C1RyW1QDcfvbrcM3P4GBxxK0XOLen8RntVeF2on0PDZMImrmFOwPZDCnp
X-Received: by 2002:a24:220c:: with SMTP id o12mr2351361ito.1.1555575797582;
        Thu, 18 Apr 2019 01:23:17 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1555575797; cv=none;
        d=google.com; s=arc-20160816;
        b=uRIYsGsfnAGBoj+wV+KSxTcMsU0MUwmQ3tv18vgqDD5xqhkNPZ7eZhxZdeLQchVscZ
         r+KUvqDaLS9LPH57GWeupv8eiVh4A3lEJOLOei1ZUrAzuFiACkUAju30hsuHGXcqeeSM
         DoqD79QkhfLq4kJksD8LxKRTJpKNOz9+IzYF1lwpsW8dYMbLqfbNz7SyObVpSDIkG1Un
         5ChRr4ckHygu6AZM04q0ymvo0PMdpoBsBFl5XYjArsNKIh/v3X+z9DwidCQO/J/kcE+y
         Xrp+8TjyH2txoxyzmaF0o+C0M9P+RyB8u4dRC3LyYXeqjv7nCY2BZiJicH1faPzNl1LR
         WVyQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=message-id:date:to:from:subject:content-transfer-encoding
         :mime-version:dkim-signature;
        bh=x1QmOPfmAREqGV3IruUfKZv2zTIATOj5nVQCBw0a1KQ=;
        b=irefjZ7w+DqBs+z4OMgBe2x4SYxIP2pFb9N4UI/6QfdhwqdDMn5FYQGckFOOZhAYEW
         iEBYptRzLmjsbYxGNoiFycHYD14IycwyXsP7hXUI2NNRm+bgG49Jdf8iqJpkIPOseyZc
         145rF5dS+jjsbGKa9NoYjUil/f0LSruyyGELt5xjQ3AsMCY4wZzOfJbIRMMwU463dg+j
         Siz2b9yEnlOFOXmGgZk0ERE2AmVLGVd9+jCnnLCUdWmWqAdbe5PPHOsWVaIYTa9cAfa1
         QU42jJvk/KcN2PAykDKy4ZTB+ZOcY60EMjGw8VN3F/Ai//3d5QlJKrjmRqxAPLWSNrWx
         Jlqg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=fail header.i=@myaa.ir header.s=2019 header.b=Q8G8809R;
       spf=pass (google.com: domain of nor...@myaa.ir designates 198.143.182.181 as permitted sender) smtp.mailfrom=nor...@myaa.ir
Return-Path: <nor...@myaa.ir>
Received: from host.myaa.ir ([198.143.182.181])
        by mx.google.com with ESMTPS id a66si894582jaa.81.2019.04.18.01.23.17
        for <arash.e...@gmail.com>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 18 Apr 2019 01:23:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of nor...@myaa.ir designates 198.143.182.181 as permitted sender) client-ip=198.143.182.181;
Authentication-Results: mx.google.com;
       dkim=fail header.i=@myaa.ir header.s=2019 header.b=Q8G8809R;
       spf=pass (google.com: domain of nor...@myaa.ir designates 198.143.182.181 as permitted sender) smtp.mailfrom=nor...@myaa.ir
Received: from host.myaa.ir (localhost [IPv6:::1]) by host.myaa.ir (Postfix) with ESMTPSA id 89D20122E25 for <arash.e...@gmail.com>; Thu, 18 Apr 2019 04:23:15 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=myaa.ir; s=2019; t=1555575796; bh=x1QmOPfmAREqGV3IruUfKZv2zTIATOj5nVQCBw0a1KQ=; h=Subject:From:To:Date:From; b=Q8G8809R+/QKFVgsnQsuEWhJ7VmKvEpbHgNjwsW4eVO6U/s/smEi6WbjlXE8/8kLx
	 0mODT/3bws2DD/Q+d7kIKvsE2VQ7GRMuV0cTD6Rt/7CA7YD4zdzuxSRE6499J4uUsJ
	 LHoc2mGISKYuIwveu/Pg/+XTXHAKa+ObAHO/rbBnyDZs9Yf1YVMQ+i1+l5XiOzaabH
	 rWILAMhGXzlXjbAOR4xHTkcfWiOpDEB7rNZvnQTHOzK+Sfe3kr8m4/0YUtV7oeP2ST
	 pA2FRx2zcXbR9Iktf9IIIvWkHTLn/P92vjJXH7+LfG3M3zbx6uXi1zel1JAB2yefSk
	 e1e6XZD4+jg0g==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [Myaa.ir] لطفا ایمیل خودتان را تأیید فرمایید
From: nor...@myaa.ir
To: arash.e...@gmail.com
Date: Thu, 18 Apr 2019 08:23:15 -0000
Message-ID: <155557579553.21365...@host.myaa.ir>

Hello from Myaa.ir!
این ایمیل را به این دلیل دریافت کردید که کاربر arash.etemaddar آدرس ایمیل شما را به عنوان آدرس خود به حساب کاربری خود متصل کرده.

برای تایید درستی این موضوع، به لینک زیر بروید:
https://myaa.ir/accounts/confirm-email/MjA:1hH2KA:c6USpdrEt0pkN5SofEBrsav6gqk/

سپاس از طرف Myaa.ir!
myaa.ir

************

Gil Obradors

unread,
Apr 20, 2019, 2:56:50 AM4/20/19
to django...@googlegroups.com
May be DKIM isn't correctly configured?

Authentication-Results: mx.google.com;
       dkim=fail header.i=@myaa.ir header.s=2019 header.b=Q8G8809R;

Missatge de Mohammad Etemaddar <mohammad....@gmail.com> del dia ds., 20 d’abr. 2019 a les 8:47:
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/248fc701-514b-4129-856b-4b77477b22e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kasper Laudrup

unread,
Apr 20, 2019, 7:09:03 AM4/20/19
to django...@googlegroups.com
Hi Gil and Mohammad,

On 20/04/2019 08.55, Gil Obradors wrote:
> May be DKIM isn't correctly configured?
>
> Authentication-Results:mx.google.com <http://mx.google.com>;
> dkim=fail header.i=@myaa.ir <http://myaa.ir> header.s=2019 header.b=Q8G8809R;
>
>

That would be my best bet as well. I would think a false DKIM header
would be even more suspicious than not having set up DKIM at all, but
again, that's up for the mail server (in this case Google) to decide.

The mail server at mail.myaa.ir seems to be fairly reasonably
configured, although it does miss stuff like a valid reverse DNS entry,
but that's not a big issue.

I would probably contact myaa.ir to figure out why they haven't
configured DKIM correctly (or whatever the DKIM issue is).

Kind regards,

Kasper Laudrup

Rumah Ilmu Indonesia

unread,
Apr 20, 2019, 2:37:24 PM4/20/19
to django...@googlegroups.com
 You can find your problem here : http://www.mail-tester.com/

Send your email to a generated address there. And then analyze it.

Or you can use https://mxtoolbox.com/

Most of problem (DKIM, SPF, DMARC) should be setting in DNS record, not django-related. For DKIM, you should know about your MTA. For most of LINUX distribution that use postfix, you can generate it with open-dkim. And then put it on your DNS configuration

Regard,
Reza Ervani
Reply all
Reply to author
Forward
0 new messages