Digital Marketing

Email SPF examples

You can set up an SPF record to prevent spammers from using your domain to send unauthorized emails, also called spoofing. Some mail recipients require SPF. If you don’t add an SPF record for your domain, your messages can be marked as spam or even bounce back.

$dig txt +short

"v=spf1 a mx ip4: ip4: -all"

The "a" and "mx" specify the systems permitted to send messages for the given domain.

To add ip of to the SPF so that can send email for


get ip of

Then change the SPF into

"v=spf1 a mx ip4: ip4: ip4: -all"

v=spf1SPF version 1

mxthe incoming mail servers (MXes) of the domain are authorized to also send mail for
The "ip4" mechanism

The argument to the "ip4:" mechanism is an IPv4 network range. If no prefix-length is given, /32 is assumed (singling out an individual host address).

"v=spf1 ip4: -all"

Allow any IP address between and

-allall other machines are not authorized

You can use dig -x ip_address to reverse lookup the ip address.

Testing tools of SPF
If you are using Amazon Simple Email Service:

If you are already publishing SPF or Sender ID records to your Domain Name Service (DNS), recipients might not receive your email. To ensure delivery, add the following to any such records:

If you use gmail API to send your email, ~all

Publishing an SPF record that uses -all instead of ~all may result in delivery problems.

Sender ID Introduction and Resources

You can add spf2.0 at the same time, it doesn't hurt:

"spf2.0/pra ip4: -all"
"v=spf1 mx -all"

Test emails sent to the Port25 email verifier

Port25 offers a really nifty public service -- you can send email to and it will reply to the from: address with an extensive diagnostic. Here's an example summary result

from a test email:

SPF check: pass
DomainKeys check: fail
DKIM check: pass
Sender-ID check: pass
SpamAssassin check: ham

Multiple SPF records are not recommended and will cause authorization problems.
If you have both SPF record type and TXT record type, most email servers will only pick up TXT record.
Gmail checks SPF on message "From" while port25 checks on envelop "From", you might get different results from them. You could add SPF to both message 'From' domain and envelop 'From' domain.

TXTThe DNS zone record type; SPF records are written as TXT records
@In a DNS file, the "@" symbol is a placeholder used to represent "the current domain"
v=spf1Identifies the TXT record as an SPF record, utilizing SPF Version 1
aAuthorizes the host(s) identified in the domain's A record(s) to send e-mail
include:Authorizes mail to be sent on behalf of the domain from
~allDenotes that this list is all inclusive, and no other servers are allowed to send e-mail


Popular posts from this blog

Make online money from the Internet