{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/whats-an-spf-record/","result":{"data":{"site":{"siteMetadata":{"title":"The Official MailPace Blog","author":"Paul, founder of MailPace"}},"mdx":{"id":"cb6d49ba-bc9d-5c4f-aac8-0b0f0bdaa2b0","excerpt":"A Sender Policy Framework (SPF) record is a piece of text that you can add to your Domain Name System (DNS). It tells email clients (such as Gmail or Outlook…","body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"What's an SPF Record? - Ultimate Guide to Email\",\n  \"date\": \"2021-02-08T22:00:03.284Z\",\n  \"description\": \"SPF records are DNS records that help prevent SPAM and forged emails\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"A Sender Policy Framework (SPF) record is a piece of text that you can add to your Domain Name System (DNS). It tells email clients (such as Gmail or Outlook) who can send email from your domain, and those clients can check each email received against this record to see if it is likely to be spam or forged.\"), mdx(\"h2\", null, \"Background\"), mdx(\"p\", null, \"SPAM has been sloshing around on the internet since forever (well \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.themarysue.com/first-spam-email/\"\n  }, \"since 1978, apparently\"), \", and so have methods to fight it. SPF is a neat way to help prevent your domain name from being abused for appearing to send spam or forged emails.\"), mdx(\"p\", null, \"The thing with email is that anyone can pretend to send emails from anyone else, there\\u2019s nothing in the specifications that prevent this. To impersonate someone, all you have to do is change the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"From\"), \" email header to say it came from them. To make matters worse, emails are handed between lots of different servers when being sent, and are rarely encrypted to prevent modifications en-route.\"), mdx(\"p\", null, \"Why is this allowed? Well email is really, really old! No one designing email could have possibly anticipated the kind of spam we see today, and computers just didn\\u2019t have the power or resources to do complex cryptography and a gazillion network requests back in the day.\"), mdx(\"p\", null, \"Fortunately there are some technologies (including SPF) that work together to help validate that an email has come from the person/place it claims to have come from.\"), mdx(\"h2\", null, \"So how do SPF records help prevent spam?\"), mdx(\"p\", null, \"An SPF record says which mail servers are allowed to send email on your behalf. So when an email arrives from a particular server, the receiving server can look up the SPF record of the domain in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"From\"), \" field and validate that the server is allowed to send email for that specific Domain.\"), mdx(\"p\", null, \"If no match is found, then depending on the SPF policy in the record, the email will be marked as spam, outright rejected or have its spam score lowered. \"), mdx(\"p\", null, \"Without SPF there would be no way to check that the server that sent an email is actually allowed to send emails for the domain. By adding an SPF record you\\u2019re telling the world that this particular IP, service or set of IPs is allowed to send email for that domain.\"), mdx(\"h2\", null, \"What does an SPF record look like?\"), mdx(\"p\", null, \"Here\\u2019s a simple record:\"), mdx(\"pre\", {\n    \"className\": \"grvsc-container default-dark\",\n    \"data-language\": \"\",\n    \"data-index\": \"0\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"grvsc-code\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"grvsc-line\"\n  }, \"v=spf1 ip4:192.168.0.1 ~all\"))), mdx(\"p\", null, \"Let\\u2019s break it down:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"v=spf1\"), \" tells whoever is looking this up that this is an SPF record, and it\\u2019s a Version 1 record. There\\u2019s only one version at present, so this will always be the same for the forseeable future\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"ip4:192.168.0.1\"), \" is an IP address that\\u2019s allowed to send emails from this domain. You can list multiple IPs here by including a space between them, add ranges or even full domains\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"~\"), \" is one of four \", mdx(\"em\", {\n    parentName: \"li\"\n  }, \"qualifiers\"), \" which tells the email client how to mark an email that matches the term to the right (in this case \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"all\"), \"). The options are pass (+), fail (-), softfail (~) or neutral (?) - using these allows you to do things like whitelist or blacklist addresses, or completely disable all emails from a given domain\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"all\"), \" simply says match all emails\")), mdx(\"p\", null, \"Email clients will evaluate this record \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"from left to right\"), \", looking for a match against the IP address that the email actually originated from. So if an email came from 192.168.0.1 it will match this record and pass SPF, but if it didn\\u2019t arrive from there it will match \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"all\"), \" and be marked as a softfail (because of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"~\"), \"). Softfail means that the email should not be rejected for this reason alone, but it will be factored into the spam score.\"), mdx(\"p\", null, \"To add this to your DNS record, open up your domain registrar or DNS management console, and add a new \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"TXT\"), \" record with the text as your content. If you\\u2019re using a service to send emails on your behalf your email service provider will give you the exact record details you need, if you\\u2019re sending emails from your own server you\\u2019ll need to craft your own record, you can use \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://tools.ietf.org/html/rfc7208\"\n  }, \"RFC7208\"), \" as a reference to get it perfect.\"), mdx(\"p\", null, \"Easy-peasy lemon squeezy!\"), mdx(\"h2\", null, \"Why don\\u2019t you need to setup an SPF record with MailPace?\"), mdx(\"p\", null, \"The good news is that you don\\u2019t need to know any of this or do anything to use MailPace and have your emails pass SPF validation.\"), mdx(\"p\", null, \"We set a specific header in the email called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Return-Path\"), \" with all emails sent through our email service. If you take a peek at a raw email sent over MailPace you\\u2019ll find that the return path ends in \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"@mailer.mailpace.com\"), \", and if you look this up in the DNS system, you\\u2019ll find an SPF record that points to our server IP address.\"), mdx(\"p\", null, \"Luckily email clients accept the return path header as the source of the email, so SPF checks pass on all our emails. without our users needing to do anything. If you do want to set your own SPF and DMARC policies with MailPace, you can enable (Advanced Verification)\", \"[https://docs.mailpace.com/guide/verification#advanced-verification]\"), mdx(\"h2\", null, \"Other technologies and further reading\"), mdx(\"p\", null, \"If you want to learn everything there is to know about SPF, you can read the RFC (\\u201CRequest For Comments\\u201D, basically the SPF specification) here: \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://tools.ietf.org/html/rfc7208\"\n  }, \"https://tools.ietf.org/html/rfc7208\")), mdx(\"p\", null, \"But SPF alone doesn\\u2019t completely solve spam, we also need DKIM, and to a lesser extent DMARC. More on those later!\"), mdx(\"style\", {\n    \"className\": \"grvsc-styles\"\n  }, \"\\n  .grvsc-container {\\n    overflow: auto;\\n    -webkit-overflow-scrolling: touch;\\n    padding-top: 1rem;\\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\\n    padding-bottom: 1rem;\\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\\n    border-radius: 8px;\\n    border-radius: var(--grvsc-border-radius, 8px);\\n    font-feature-settings: normal;\\n  }\\n  \\n  .grvsc-code {\\n    display: inline-block;\\n    min-width: 100%;\\n  }\\n  \\n  .grvsc-line {\\n    display: inline-block;\\n    box-sizing: border-box;\\n    width: 100%;\\n    padding-left: 1.5rem;\\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\\n    padding-right: 1.5rem;\\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\\n  }\\n  \\n  .grvsc-line-highlighted {\\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\\n  }\\n  \\n  .default-dark {\\n    background-color: #1E1E1E;\\n    color: #D4D4D4;\\n  }\\n\"));\n}\n;\nMDXContent.isMDXComponent = true;","frontmatter":{"title":"What's an SPF Record? - Ultimate Guide to Email","date":"February 08, 2021","description":"SPF records are DNS records that help prevent SPAM and forged emails"}}},"pageContext":{"slug":"/whats-an-spf-record/","previous":{"fields":{"slug":"/send-emails-over-smtp/"},"frontmatter":{"title":"Send emails over SMTP with MailPace.com"}},"next":{"fields":{"slug":"/send-attachments-with-ohmysmtp/"},"frontmatter":{"title":"Send attachments with transactional emails"}}}},"staticQueryHashes":["1956864136","63159454"]}