Prevent your Gmail Email Messages from Getting Rejected as Spam

Published in: Gmail - GSuite

Spammers Forge Email Address

The majority of email spam on the Internet originates from forged addresses because SMTP allows any computer to send emails claiming to be from anyone.

For instance, a spammer can put your email address in the “From” field when sending out bulk emails and the recipients may therefore incorrectly assume that the mail is coming from you. If any of them chooses to report that spoofed message as spam, its your email address that will be affected in the long run.

Authenticate your Google Apps Domain with SPF

To prevent spammers from forging the “From” field of their bulk messages with your email address, you can consider using a validation system like SPF (short for Sender Policy Framework). It basically allows the email recipients to verify that the server sending the email is authorized to send email on behalf of the domain that is found in the sender’s email address.

Let me explain. If the IP address of my mail server is, I can add an SPF record to my web domain saying that all messages coming from this particular IP address. ISPs can match the mail server address mentioned in my domain’s SPF record against the one present in my emails and accordingly pass or bounce messages to their customers.

How to Implement SPF in Google Apps and Gmail

Let’s say you have a Google Apps domain at and you are using the Gmail service for your incoming and outgoing email.

To add an SPF record to your domain, first open the page from where you can edit your domain’s DNS records. Then add a new DNS record of type “TXT” and set the value as

v=spf1 ~all

Save the changes and this new DNS record should propagate across the Internet within the next few hours. If you are interested in the technical details, here they are are:

The entry means that any server that is allowed to send mail from the IP addresses of Google Apps mail servers is also allowed to send mail from The ~all directive means that email messages that are not sent from an approved server should still be accepted but may be subjected to greater scrutiny.

How to Check SPF Records of your Google Apps Domain

Check DNS RecordsTo ensure that your SPF record has been successfully added to your web domain, open your command prompt - go to Windows Start Menu -> Run and type cmd.

Nex run the nslookup command for your Google Apps Domain as shown below:

c:> nslookup
c:> set query=txt
c:> (replace with your Google Apps domain name)

If the answer contains the string that you have added in the previous step, it indicates that SPF is successfully enabled for your Google Apps / Gmail.

Verify SPF Records with an Email Message

Finally, to verify that your SPF record is live and working, just send a blank email message to and from your Gmail address.

You’ll get an instant reply with the results of the SPF check. If you see a “pass” against the SPF check, that means things are in place and it should prevent your Gmail messages from getting rejected as spam because now the recipient can distinguish forged emails from the real ones with a simple check.

Related: Prevent Gmail from Marking Emails as Junk

📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: Gmail - GSuite

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube