Search code examples
dnsmailgunspf

Multiple SPF records: gmail and mailgun


I need have two SFR recordings.

gmail: v=spf1 a mx include:_spf.google.com ?all

mailgun: v=spf1 include:mailgun.org ~all

Final result: v=spf1 a mx include:_spf.google.com include:mailgun.org ~all

All is well with "a mx" and "~all" parts?


Solution

  • Your merged record looks correct. It can be discussed what the qualifier of all should be. The gmail record has ?all while the mailgun record has ~all.

    ~all in the final record indicates that you are almost 100% sure that only the listed addresses will be used to send mail for your domain (other addresses will result in a softfail result), while a ?all would indicate that you don't know if there are other servers sending valid mail for the domain (unlisted addresses will result in a neutral result).

    And in the end it's up to the receiving server to decide what to do with the mail based on the result of the SPF validation.