When you add a specific sender email address, an automatic activation email will be sent to it. To complete the validation, you need to have access to the respective sender’s inbox, as well as your Mailjet account’s username and password. Simply click on the activation link within the email and when prompted, log into the account.
You can activate the domain by creating a TXT record in its DNS zone file.
Do a GET on /dns/{domain_ID or domain_name} to retrieve the values you need for the DNS record.
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
}Use OwnerShipTokenRecordName for the host and OwnerShipToken for its value.
Mailjet will perform regular checks for your DNS settings, but you can do an immediate check via a POST request on /dns/{domain_ID or domain_name}/check.
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/dns/$dns_ID/check \
-H 'Content-Type: application/json' \
-d '{
}'{
"Count": 1,
"Data": [
{
"DKIMErrors": "",
"DKIMRecordCurrentValue": "",
"DKIMStatus": "Error",
"SPFErrors": "",
"SPFRecordCurrentValue": "",
"SPFStatus": "OK"
}
],
"Total": 1
}Another option to validate your sender domain is to temporarily upload a .TXT file to your website.The text file name can be found in the property Filename when doing a GET on /sender/$id. You just need to create a file with this name at the root of your website.
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/sender/$sender_ID \{
"Count": 1,
"Data": [
{
"EmailType": "bulk",
"IsDefaultSender": false,
"Name": "Marketing sender",
"CreatedAt": "2018-01-01T00:00:00",
"DNSID": 1234567890,
"Email": "pilot@mailjet.com",
"Filename": "a12345b67c123456ab1ca12345b1234b5.txt",
"ID": 1234,
"Status": "Inactive"
}
],
"Total": 1
}Mailjet will be looking for http://www.yourdomain.com/[filename].
Complete the validation by doing a POST on /sender/{sender_ID or sender_email}/validate.
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/sender/$sender_ID/validate \
-H 'Content-Type: application/json' \
-d '{
}'{
"Count": 1,
"Data": [
{
"ValidationMethod": "",
"Errors": "",
"GlobalError": ""
}
],
"Total": 1
}