I want to use a mass mailing service, e.g. sendgrid, mailgun, etc. And so I must update my zone file to include the correct SPF records.

Suppose my domain is example.com.

My DNS provider automatically set up SPF like this:

type:  TXT
key:   example.com
value: v=spf1 include:spf.mydnsprovider.com ~all

Now Sendgrid tells me I need to add this:

type:  TXT
key:   foo123.example.com
value: v=spf1 include:sendgrid.net ~all

I've read that I can combine multiple SPF entries in a single TXT record like this:

v=spf1 include:spf.mydnsprovider.com include:sendgrid.net ~all

However Sendgrid specifies that I create a separate TXT record, which applies to a subdomain (foo123.example.com).

I'm unsure what to do. If I do what they say and add a separate record, what are the ramifications? Should I merge them, or do what Sendgrid recommends?

up vote 1 down vote accepted

Are you using foo123.example.com for your sending domain at sendgrid? If so, you need to just set their SPF for that domain name only. You do not need to merge it into your top level domain. If you are sending mail using your top level domain via sendgrid as well (not just the visible From address, but the SMTP bounce address), then add sendgrid to your top level domain SPF record.

Do not create separate records for any domain. Always merge them into one record. Be careful of the size limit, too.

  • I don't really understand your question, I've never fiddled with SPF/DKIM before, so please bear with me... :-) I use my dns/hosting provider for everything - DNS, hosting, email (both SMTP and POP3/IMAP), etc. I want to use sendgrid ONLY to send bulk emails. Your text seems contradictory because you say I should never merge records, but you recommend I do in the first para. I want to send bulk using sendgrid, and for it to appear it comes from me ("from") not sure what you meant by bounce address. – lonix Oct 12 at 6:21
  • I say never have separate records; always merge them. The only relevant domain name for your SPF is the one Sendgrid has you configure, so you don't need to add their SPF record to your bare domain. – vick Oct 30 at 3:07

If you are always using a subdomain in your sender emailaddress to send mail through SendGrid (i.e. info@foo123.example.com as opposed to info@example.com), then you should set up a separate SPF record for the subdomain.

The better you can distinguish the email servers per subdomain, the better the security provided by SPF will be.

  • The subdomain was specified by sendgrid, not me - I only want to send as info@example.com. So am I correct in assuming that I should only have one TXT record, which is a merge of my existing spf info and the sendgrid spf info - and ignore their useless "help" page? :) – lonix Oct 12 at 12:33
  • Your visible From address and the SMTP return address are not always the same. If Sendgrid had you set up a domain to send mail, then that is what is being used in the SMTP return address, and what will be relevant for the SPF record. Your bare domain will not matter. – vick Oct 30 at 3:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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