Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm sending an email through my application code. The email gets into my Gmail spam folder. However, a test of the same email in ISnotSPAM is marked as non-spam. My application is using Sendgrid to send emails. Will appreciate some advice to avoid reaching the spam folder.

Below is an example of ISnotSPAM report, marking the email as non-spam. The same email has reached my gmail's spam folder.

Summary of Results

SPF Check : pass
Sender-ID Check : neutral
DomainKeys Check : pass
DKIM Check : pass
SpamAssassin Check : ham (non-spam)

HELO hostname: mail-bk0-f48.google.com
Source IP:
mail-from: olgaduboshin@gmail.com
SPF check details:

Result: pass
ID(s) verified: smtp.mail=myemail@gmail.com
DNS record(s):
gmail.com.   155    IN  TXT "v=spf1 redirect=_spf.google.com"

Sender-ID check details:

Result: neutral
ID(s) verified: smtp.mail=myemail@gmail.com
DNS record(s):
gmail.com.   155    IN  TXT "v=spf1 redirect=_spf.google.com"

DomainKeys check details:

Result: pass
ID(s) verified: header.From=myemail@gmail.com
DomainKeys DNS Record=._domainkey.

DKIM check details:

Result: pass
ID(s) verified: header.From=myemail@gmail.com
DomainKeys DNS Record=20120113._domainkey.gmail.com

SpamAssassin check details:
SpamAssassin v3.3.1 (2010-03-19)

Result: ham (non-spam) (0-1.1points, 10.0 required)

pts rule name description
---- ---------------------- -------------------------------

* 0.0 FREEMAIL_FROM Sender email is freemail (myemail[at]gmail.com)
* -0.0 SPF_PASS SPF: sender matches SPF record
* 0.1 HTML_MESSAGE BODY: HTML included in message
* 0.0 BAYES_50 BODY: Bayes spam probability is 40 to 60%
* [score: 0.5000]
* -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
* domain
* 0.0 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
* valid
* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
* -1.0 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
* trust
* [ listed in list.dnswl.org]
X-Spam-Status: Yes, hits=-1.1 required=-20.0 tests=BAYES_50,DKIM_SIGNED,
X-Spam-Score: -1.1

To learn more about the terms used in the SpamAssassin report, please search
here: http://wiki.apache.org/spamassassin/
share|improve this question
Just curious, when you view the message in your spam folder Gmail often times says something at the top like "Marked spam because other users have done so" or "Marked spam because of the wording". Do you have anything like that for these messages? Also, I have used other sending services before but not SendGrid – what are the actual headers of the email that they send? Can you post them or some of them? – Charlie S Mar 14 '13 at 19:14
Soliciting general advice on deliverability is not appropriate for a Q&A forum. Also, this post isn't about spam prevention. – Lèse majesté Mar 15 '13 at 0:01

What do you mean by 'sending an email through my application'. If you have a server other than a google server touching it and forwarding it, and it says the originator is supposed to be somebody@gmail.com, then that alone could trigger Google to mark it as 'spam'.

Basically, any server that touches an email will add headers to the message so that it is traceable. If gmail receives a message that purportedly came from a gmail account, but the headers say that it, in fact, came from some non-gmail server, then gmail will treat it as suspicious.

Owners of such systems can use SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) to help Google verify their validity.

SPF works simply by adding a TXT record to the name servers for the domain sending the emails. The record will identify which IPs are valid senders for the domain. It looks like that isn't the problem here.

In the case of DKIM, a domain owner generates private/public key-pairs that will be used to sign messages originating from that domain. The public-key is placed in DNS as a TXT record. The private-key is kept on the mail server which sends email for the domain. It is used to calculate a signature that is placed in the email header.

When a message is received with a DKIM-Signature header, opendkim extracts the signature and the sender's domain from the email and finds the TXT record for that domain. Using the public-key it finds there, opendkim verifies whether the signature of the email is valid.

Your message seems to have a DKIM signature which can't be verified as valid: "DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid"

share|improve this answer

Has this been seen only through testing? I've run into similar problems when sending email from my Google account address to that same account. It seems that because Google recognises that the account didn't actually send itself email from the Google server it marks it as spam because the email address has been 'spoofed'. If this is the case for you, you can try sending to an alternate email address and see if you get the same result.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.