SPF & DKIM are authentication systems that tell Internet Service Providers (ISPs), like Gmail and Yahoo, that incoming mail has been sent from an authorized system, and that it is not spam or email spoofing. To set Mailjet as an authorized sender and improve your deliverability, you need to modify your DNS records to include DKIM signature and SPF.
To retrieve your SPF and DKIM authentication records, do a GET on /dns/{domain_id or domain_name}.
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/dns/$dns_ID \{
"Count": 1,
"Data": [
{
"DKIMRecordName": "mailjet._domainkey.example.com.",
"DKIMRecordValue": "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAB",
"DKIMStatus": "OK",
"Domain": "example.com",
"ID": 1234,
"IsCheckInProgress": false,
"LastCheckAt": "2018-01-01T00:00:00",
"OwnerShipToken": "123a4bc56d7890efg123h4ijk56l78mn",
"OwnerShipTokenRecordName": "mailjet._123a4bc56.example.com.",
"SPFRecordValue": "v=spf1 include:spf.mailjet.com ?all",
"SPFStatus": "OK"
}
],
"Total": 1
}The information you need from the response is:
DKIMRecordName: contains the name of the DNS txt record for the DKIM configurationDKIMRecordValue: contains the value of the DNS txt record for the domain DKIM configurationDKIMStatus: last result of the domain DKIM configuration check ran (via the check action or a periodic check on Mailjet side). The status can be Not checked, OK or Error.SPFRecordValue: contains the name of the DNS txt record for the SPF configuration. Please note that this field contains the default value, not taking into account existing SPF records for the domain. Concatenating this with the existing value is left up to the API client.SPFStatus: last result of the domain SPF configuration check ran (via the check action or a periodic check on Mailjet side). The status can be Not checked, OK or Error.
Follow the "How to setup DomainKeys (DKIM) and SPF in my DNS records" guide to learn how to use this information to modify your DNS records.
Once you have finished the setup of your DNS records, do a POST request on /dns/{domain_ID or domain_name}/check to complete the validation.