0

I configured my Django 1.6 framework to send error reports to a Gmail account so I can check them. Before this worked well, though I had to define filters to catch the sender mail addresses I configured for those e-mail reports to be marked as "Not spam" and properly categorized. The filters worked, though a message appeared every time I opened a report, like "This is not in Spam folder because you marked it as Not Spam".

...until a few days ago. Reports stopped arriving. I checked out the logs in /var/log/mail.log and found this:

Our system has detected that this message is 550-5.7.1 likely unsolicited
mail. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message
has been blocked. Please visit 550-5.7.1
http://support.google.com/mail/bin/answer.py?hl=en&answer=188131
for 550 5.7.1 more information. t17si11455054wiv.44 - gsmtp
(in reply to end of DATA command))

Almost all my error reports are being blocked by Gmail, so I went to Google's Bulk Senders Guidelines to try to resolve this. My mail server uses a consistent IP address and the domain has got a proper reverse DNS record, but the sender address may change depending on subdomain which had the error (for instance: error.site1@mydomain.com if subdomain1 threw the exception, or error.site2@mydomain.com if it was subdomain2).

The question is: How may I check out if other more advanced requirements are met by my postfix mail server, such as message formatting, and reconfigure them if necessary?

Please keep in mind that both postfix and django's mail reporting system are implied in the process of sending a report.

Also, please notice that I'm a newbie with mail servers and email message formatting, but I'm a programmer, so I'm not allergic to the code.

EDIT: I also checked out, just in case, if my host was in any spam blacklist using mxtoolbox.com, it seems that my host isn't blacklisted...

EDIT2: A sample of mail header:

Delivered-To: receivermailaccount@gmail.com
Received: by ***.***.***.*** with SMTP id *****************;
    Mon, 9 Mar 2015 00:33:13 -0700 (PDT)
X-Received: by ***.***.***.*** with SMTP id *******************************;
    Mon, 09 Mar 2015 00:33:09 -0700 (PDT)
Return-Path: <error.site1@mydomain.com>
Received: from myVPS_machinename (<Some reverse domain name of my VM's host, but not mydomain.com> [***.***.***.***])
    by mx.google.com with ESMTP id **************************************
    for <receivermailaccount@gmail.com>;
    Mon, 09 Mar 2015 00:33:09 -0700 (PDT)
Received-SPF: none (google.com: error.site1@mydomain.com does not designate permitted sender hosts) client-ip=***.***.***.***;
Authentication-Results: mx.google.com;
   spf=none (google.com: error.site1@mydomain.com does not designate permitted sender hosts) smtp.mail=error.site1@mydomain.com
Received: from myVPS_machinename (localhost [127.0.0.1])
by myVPS_machinename (Postfix) with ESMTP id **********
for <receivermailaccount@gmail.com>; Mon,  9 Mar 2015 08:33:09 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [Django] ERROR (EXTERNAL IP): Internal Server Error: /pma/scripts/setup.php
From: error.site1@mydomain.com
To: receivermailaccount@gmail.com
Date: Mon, 09 Mar 2015 07:33:09 -0000
Message-ID: <*************************@myVPS_machinename>

Obviously I am hiding potentially sensible information due to security reasons.

SebasSBM
  • 143
  • 1
  • 10
  • Postfix has nothing to do with message formatting. Postfix is a MTA, Mail **Transport** Agent. Can you post the sample of header of django email in your Gmail Inbox? – masegaloeh Mar 23 '15 at 13:25
  • Your header above confirm the case mentioned by @Mike below :) – masegaloeh Mar 23 '15 at 16:37
  • Well, I was able to see the whole mail header from one of the reports, and posted it. While doing it, **I noticed that in one of the RECEIVED instances was using the reverse URL that points to my VM** (but not the domain I use to deploy my sites at all). I replaced it with tag. **I noticed that my host didn't had a reverse DNS record just a few days ago and updated it with mydomain.com** . Maybe the internet's DNS servers have to get updated yet? – SebasSBM Mar 23 '15 at 16:38
  • yes, please our canonical question about [How to send emails and avoid them being classified as spam](http://serverfault.com/questions/48428/how-to-send-emails-and-avoid-them-being-classified-as-spam) – masegaloeh Mar 23 '15 at 16:41
  • Good apportation. The linked question apports useful information that may help resolving the issue. One fragment of the answer in the link called my attention: `don’t insert “IP-address only” links`. I remember some of the IPs present in my error reports (just some concrete IPs) were automatically converted into hyperlinks for some reason. Maybe I should investigate about this misterious hyperlinks - after creating SPF and DKIM records as @Mike said. – SebasSBM Mar 23 '15 at 17:16

1 Answers1

1

So Google thinks you are sending enough mail to qualify as a bulk sender. So you need to setup a SPF record at least for the domain you are sending from and preferably also a DKIM record in DNS.

Those pretty much allow Google to query your DNS zone file for the domain and ask.. is this sender valid to send email from this domain.

Mike
  • 21,910
  • 7
  • 55
  • 79
  • It makes sense, django was sending to me more-or-less 50 error reports everyday (most of them were DisallowedHost reports that informed about suspicious requests). I will read more deeply the information about SPF and DKIM records. Thank you. – SebasSBM Mar 23 '15 at 13:31