# Sending Domain Setup

<details>

<summary>For use with AI assistants</summary>

AI-readable resources:

This page as Markdown — <https://docs.mailtrap.io/email-api-smtp/setup/sending-domain.md>

API reference as Markdown — <https://docs.mailtrap.io/developers/email-sending/sending-domains.md>

llms.txt — <https://docs.mailtrap.io/llms.txt>

llms-full.txt — <https://docs.mailtrap.io/llms-full.txt>

For setup with AI assistant follow these steps. Pause and confirm with the user before proceeding at steps marked with ⏸️.

1. Add a sending domain via the Mailtrap API (POST [https://mailtrap.io/api/accounts/{account\_id}/sending\_domains](https://mailtrap.io/api/accounts/%7Baccount_id%7D/sending_domains)) with my domain name.
2. Retrieve the DNS records from the API response — expect 4 CNAME records (domain verification, 2× DKIM, tracking) and 1 TXT record (DMARC).
3. Add the DNS records at my domain registrar. If I give you API credentials for my registrar (Cloudflare, AWS Route 53, etc.), configure them programmatically.
4. Check DNS propagation using dig CNAME \<record> or a DNS checker tool. DNS can take 15 minutes to 24 hours.
5. Verify the domain via the API (GET [https://mailtrap.io/api/accounts/{account\_id}/sending\_domains/{sending\_domain\_id}](https://mailtrap.io/api/accounts/%7Baccount_id%7D/sending_domains/%7Bsending_domain_id%7D)) or tell me to click Verify DNS Records in Sending Domains (<https://mailtrap.io/domains>).
6. ⏸️ DNS takes time — test with Sandbox now? While waiting, send a test email to Mailtrap Sandbox so we validate the integration code.
7. ⏸️ Domain verified — send a live email? Once verified, generate sending code using my domain and send a test email.

My domain: \[tell the assistant your domain]

My registrar: \[tell the assistant your DNS provider]

</details>

Need help adding DNS records for your specific provider? Check out our detailed step-by-step guides:

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>AWS Route 53</td><td><a href="/pages/UUxpYWqjlaM2ZrjigQb3">/pages/UUxpYWqjlaM2ZrjigQb3</a></td></tr><tr><td>Cloudflare</td><td><a href="/pages/TQqIYDlnZ1n7cuCUW7Ds">/pages/TQqIYDlnZ1n7cuCUW7Ds</a></td></tr><tr><td>DigitalOcean</td><td><a href="/pages/1whIF4YwDJ2waV6w0sMD">/pages/1whIF4YwDJ2waV6w0sMD</a></td></tr><tr><td>GoDaddy</td><td><a href="/pages/RL0CBWlxSAnf79rtupFm">/pages/RL0CBWlxSAnf79rtupFm</a></td></tr><tr><td>Google Cloud DNS</td><td><a href="/pages/7ar0ofACCjROVwBM5mij">/pages/7ar0ofACCjROVwBM5mij</a></td></tr><tr><td>Namecheap</td><td><a href="/pages/zUBmh25dc2zj8hYEqAtr">/pages/zUBmh25dc2zj8hYEqAtr</a></td></tr><tr><td>Squarespace</td><td><a href="/pages/x4MPKEGTwu7tFdfA9gE8">/pages/x4MPKEGTwu7tFdfA9gE8</a></td></tr></tbody></table>

### Setting up your domain <a href="#setting-up-your-own-domain-ys86q" id="setting-up-your-own-domain-ys86q"></a>

{% @arcade/embed flowId="39p36H3XvIxXKeKthmsd" url="<https://app.arcade.software/share/39p36H3XvIxXKeKthmsd>" %}

{% stepper %}
{% step %}
**Add domain**

Go to *Sending Domains* in the left navigation panel and click *Add Domain*.

Type in the domain from which you want to send emails and click Add. Remember that you should be the domain owner with access to its DNS records/have someone with access to DNS records.

After this step, you’ll see the Domain Verification page.
{% endstep %}

{% step %}
**Domain verification**

At this stage, you need to verify the domain. You have two options:

* Send domain verification instructions to your admin or developer;
* Or verify the domain yourself if you have access to your domain’s DNS records (your domain provider account).

{% hint style="success" %}
To send instructions to your admin or developer, enter their email address and click Send Instructions.
{% endhint %}
{% endstep %}

{% step %}
**Company / personal information**

After adding your DNS records, click on “Fill in Compliance Form” to complete a short form where you’ll be asked to provide either business or personal information.

Please keep in mind that it’s crucial to provide correct information corresponding to your company registration details. It is important in order to comply with international regulations. This information may also be automatically added to the email footer of promotional emails sent from your domain.

{% hint style="success" %}
Tip: If you've provided this information before, you won't be asked to fill it in again.
{% endhint %}

You can switch between personal and business information only once, meaning that you cannot change it after the form is submitted.
{% endstep %}

{% step %}
**Compliance check**

Compliance check is a process of checking every new domain added to Mailtrap.

Once all the DNS records are successfully verified, your domain will undergo an automatic review. This usually takes a couple of minutes. If your domain is verified at this stage, you’ll see the Verified badge next to your domain and below Compliance Check, and you’ll be able to start sending the emails. You’ll also receive an email informing you that your domain is ready for sending emails.

Some domains may be selected for additional checks. If so, we’ll ask you to fill out a simple Compliance Form and answer a few questions about your business, sending goals, etc. You’ll see a notification under Compliance Check and a link to the form.

We’ll email you if we need additional information from you. If all the checks are successful at this stage, your domain will be verified.

In some cases, your domain may be selected for manual verification. This is the final check before your domain is verified. The length of the manual verification depends on how fast you reply to our emails. If successful, you'll see Verified status. If not, you'll see a Rejected badge next to your domain and a message under Compliance Check. In case of any questions about the reasons for rejection, please contact our support team at <support@mailtrap.io>.

<div align="left" data-with-frame="true"><figure><img src="/files/IDtAhH5T85xWyV4dl4U4" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### To verify the domain yourself

{% hint style="info" %}
In the example below, we'll be using GoDaddy.
{% endhint %}

{% stepper %}
{% step %}
Go to your domain provider and locate the domain you've added to Mailtrap.

<div align="left" data-with-frame="true"><figure><img src="/files/Ivno1Tx1jnTEgSFdHDOw" alt="GoDaddy domain list showing mailtrap.club domain" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Open the DNS settings and click Add New Record.

<div align="left" data-with-frame="true"><figure><img src="/files/QrfdF2BTF8BPgJPoUgCg" alt="GoDaddy DNS Management with Add New Record button" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Return to Mailtrap. On the Domain Verification page, you'll see the DNS records you need to add to your domain provider. These are **Domain Verification**, **DKIM**, **DMARC**, and **Domain Tracking**. You'll need the values under **Type**, **Name**, and **Value**. The naming of these records in Mailtrap is the same as in most domain providers but may differ slightly depending on the provider.

<figure><img src="/files/iTRFBnQHuNTcL8xTCkSA" alt=""><figcaption></figcaption></figure>

Make sure you check the type next to each record in Mailtrap and choose a relevant one in your domain provider. There are **four CNAME type records** (Domain Verification, DKIM (2), and Custom Tracking Domain) and **one TXT type record** (DMARC).

<figure><img src="/files/Pa7maBsEjc2law4maZGZ" alt=""><figcaption></figcaption></figure>

<div align="left" data-with-frame="true"><figure><img src="/files/ADl3DsRQE9uu7CnEzYq5" alt="DNS record type dropdown in GoDaddy showing CNAME selected" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Copy the Name and Value for each record one by one. You can do this by hovering and clicking each record.

<div align="left" data-with-frame="true"><img src="/files/U2kdkYuQ3MNR0qzav5mb" alt="" width="563"></div>
{% endstep %}

{% step %}
Paste them into your domain provider.

<div align="left" data-with-frame="true"><figure><img src="/files/YSGb08Yto095REbk4Ywa" alt="GoDaddy DNS new record form with CNAME type, name, and value fields" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Click Save after adding each record in your domain provider.
{% endstep %}

{% step %}
Repeat the process of copying and pasting for each record until you've added all the Mailtrap DNS records to your domain provider.

<div align="left" data-with-frame="true"><figure><img src="/files/zLjL3EnCyfHF1CqVKWij" alt="GoDaddy DNS records table showing all Mailtrap DNS records added" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Then, return to Mailtrap. Some records may be verified immediately, while some may take more time. Mailtrap will check the DNS records automatically every hour, but you can force a check by clicking the Re-check DNS Records button.

<div align="left" data-with-frame="true"><img src="/files/pKiibfRsYX8m9BBx6Anx" alt="" width="563"></div>
{% endstep %}

{% step %}
If you add all the required DNS records correctly, the Status of DNS records will change from Missing to Verified, and the red dots will turn green.

<div align="left" data-with-frame="true"><img src="/files/oRISqQzmSkvUsjlxsU2h" alt="" width="563"></div>
{% endstep %}

{% step %}
Once the DNS records are verified, you’ll be taken to the next step, which is Compliance Check.

**Notes:**

* Some domain providers require a postfix format of the DKIM record. If that’s the case, replace `rwmt1._domainkey` with `rwmt1._domainkey.yourdomain.com` . Repeat the process for `rwmt2._domainkey` , changing the name to `rwmt2._domainkey.yourdomain.com` .
* If you’re asked to set TTL, use the default value as indicated under the TTL field on the Domain Verification page in Mailtrap.
  {% endstep %}
  {% endstepper %}

### DNS propagation time

After you add or update DNS records, it may take **15 minutes to a few hours** for Mailtrap to detect them.

DNS changes are not applied instantly because:

* DNS records are cached by DNS resolvers according to their TTL (Time To Live).
* There are multiple DNS servers worldwide, and updates need time to propagate across them.
* Even if you can see the updated record using one DNS checker or resolver, it doesn’t necessarily mean that Mailtrap (or other services) can already resolve it from their location.

In most cases, propagation completes within a few hours, but in rare cases it may take up to 24 hours.

#### How to check if your DNS records have propagated

To check if your DNS records have propagated, you have two options:

<details>

<summary>DNS Checker (automatic)</summary>

An easy way to verify whether your DNS records are publicly available is to use [DNS Checker](https://dnschecker.org/), which queries DNS servers worldwide and shows DNS propagation of 6 continents.

To use DNS Checker:

* Go to dnschecker.org and enter your domain name

<figure><img src="/files/HFmx2HFIzxbz9Ciw0f8z" alt=""><figcaption></figcaption></figure>

* Select the record type (e.g., TXT, MX, CNAME, etc.)
* Click **Search**

And here's what your results should look like:

<figure><img src="/files/KP377PxO5kTdUM3DNIgs" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary><code>dig</code> command (manual)</summary>

You can also verify your DNS records manually with the `dig` command. The `dig` command is a DNS lookup tool available on macOS and Linux (and on Windows via BIND tools) that queries DNS servers and returns the current records for a domain.

To use it, open a terminal and run dig followed by the record type and your domain name. You can also add `+short` for a concise output.

For instance, here's what you can run if you want to check:

* A TXT record (for SPF or domain verification):

```
dig TXT yourdomain.com +short
```

* A specific selector (e.g., DKIM):

```
dig TXT selector._domainkey.yourdomain.com +short
```

* MX records:

```
dig MX yourdomain.com +short
```

* CNAME records:

```
dig CNAME track.yourdomain.com +short
```

**If the correct value is returned in the response**, the record has likely propagated.

**If you see no result or an old value**, the record may still be propagating.

You can also check propagation using different public DNS resolvers:

```
dig TXT yourdomain.com @8.8.8.8 +short      # Google DNS
dig TXT yourdomain.com @1.1.1.1 +short      # Cloudflare DNS
```

</details>

**If the record appears across multiple public resolvers**, it should soon be visible to Mailtrap as well.

**If the records are correctly configured and still not verified after several hours**, double-check:

* Record type (TXT, CNAME, MX, etc.)
* Host/name field (e.g., using `selector._domainkey` instead of the full domain)
* That there are no duplicate or conflicting records

If everything looks correct, please allow additional time for propagation before contacting support.

### (Optional) Tracking settings <a href="#optional-tracking-settings-ffi49" id="optional-tracking-settings-ffi49"></a>

An optional step is to change the tracking settings. By default, Mailtrap tracks email opens for each email sent. You can also enable click tracking.

{% hint style="info" %}
*Click tracking* and *custom domain for clicks tracking* are available only for paid accounts.
{% endhint %}

<div data-with-frame="true"><img src="/files/5ZfVIw3AbPw09X5h0Ird" alt=""></div>

With tracking enabled, you will find the open and click rates in the Analytics reports. [Read this article](https://github.com/mailtrap/mailtrap-docs/blob/main/documentation/statistics/README.md) for a detailed breakdown of Statistics.

1. Navigate to the Tracking Settings tab.

<div align="left" data-with-frame="true"><img src="/files/xyZoaFYAjPUgX9EYT1ZR" alt="" width="563"></div>

2. Toggle the switch next to Track Opened Emails to enable or disable tracking opens. Mailtrap tracks email opens via an invisible pixel. It’s added to each message sent from your account. When an email is opened, a pixel is loaded, and an ‘open’ event is recorded. Each of these events will be visible in [Email Logs](https://docs.mailtrap.io/email-api-smtp/analytics/logs).

{% hint style="info" %}
Some mailbox providers, browsers, and extensions block invisible pixels. Users can also choose not to display images, or a solution they use to retrieve emails may not support images by default. In each of these cases, an 'open' event won't be recorded even if an email is opened.
{% endhint %}

<div align="left" data-with-frame="true"><img src="/files/F0JslDcg5H0llsOSJQaa" alt="" width="563"></div>

3. If you're a paid user, toggle the switch next to Track Clicks to enable or disable tracking clicks. If you enable click tracking, the toggle for Custom Domain for Clicks Tracking will be switched on automatically. That way, all links will be redirected through your domain (mt-link.yourdomain.com). And if you verified all the records correctly in Step 2, Domain Tracking will also be verified and ready to use.

<div align="left" data-with-frame="true"><img src="/files/qjnibP8w67rhrgWc4tlQ" alt="" width="563"></div>

### Unsubscribe settings <a href="#unsubscribe-settings-ekyqh" id="unsubscribe-settings-ekyqh"></a>

You can also configure unsubscribe settings.

Unsubscribe links are mandatory for bulk emails as per privacy laws. If your emails don't include an unsubscribe link, Mailtrap will add an Unsubscribe Footer automatically. This is what it will look like:

<div align="left" data-with-frame="true"><img src="/files/IerdwbR3DFyUuLC4fJKN" alt="" width="375"></div>

To add an unsubscribe link anywhere in your template, include this tag in your HTML template: `<a href="__unsubscribe_url__">unsubscribe</a>` . Mailtrap will render a clickable link in your email.

Unsubscribe Footer and Links are optional for transactional emails and are switched off by default.

However, if you want to, you can still add an Unsubscribe Footer to your transactional emails by toggling the switch On under Unsubscribe Footer for Transactional emails or adding an HTML tag mentioned above.

<div align="left" data-full-width="true" data-with-frame="true"><img src="/files/l5P2ODVeLkODAJPUNLFW" alt=""></div>

If you’d like, you can mix both approaches: automatically add a footer to emails sent from one domain and do it manually (when applicable) for emails sent from another domain.

If an end-user uses an unsubscribe link, Mailtrap will reject any future emails sent to this address from this particular domain. You can quickly find all such emails in the Email Logs by filtering for the “reject” event.

You will still be able to email them using other domains or subdomains added to your Mailtrap account.

For that reason, it's worth having different domains or subdomains for different types of emails. This way, users can, for example, unsubscribe from your bulk or marketing messages while still receiving vital transactional messages.

### (Optional) Webhooks <a href="#optional-webhooks-4hmes" id="optional-webhooks-4hmes"></a>

Lastly, you can set up webhooks to receive event information almost real-time.

<div align="left" data-with-frame="true"><img src="/files/q8gjtt6cw0giakcNOjpO" alt="" width="563"></div>

Click the Add New Webhook button, choose the Sending Stream, paste the webhook URL (your endpoint) into the designated field, select the events you want to listen to, and then test the setup.

<div align="left" data-with-frame="true"><img src="/files/pI4wyRb0wMchg76CR4So" alt="" width="563"></div>

Mailtrap also allows you to batch up to 500 events within a webhook. That is, group all events under one object, and thus save on computing power.

### Useful tips <a href="#sending-domains-j_1ht" id="sending-domains-j_1ht"></a>

After completing the setup process, you can always return to the Sending Domains tab to add any additional domains or subdomains. If you, for example, misspelled a domain, you’ll need to delete it and re-add it with the correct spelling.

{% hint style="info" %}
You can't create any additional demo domains, but you can delete an existing one if needed.
{% endhint %}

<div align="left" data-with-frame="true"><figure><img src="/files/frHkUFdzoZk8iGdqZKho" alt="Sending Domains list showing verified domains with status and emails sent" width="563"><figcaption></figcaption></figure></div>

Remember that the domain with the Demo badge can be used to send emails only to the email address you registered with.

<div align="left" data-with-frame="true"><figure><img src="/files/SGEn91sUtP5TDl8c4ZGl" alt="Demo domain showing restriction message that it can only send to yourself" width="375"><figcaption></figcaption></figure></div>

You can send emails to your recipients only from domains that have a Verified status. If the status is Pending or Rejected, you won't be able to send emails.

<div align="left" data-with-frame="true"><figure><img src="/files/wYD5Dp0grLdbEsaXTEfC" alt="Sending Domains showing pending and verified status badges" width="375"><figcaption></figcaption></figure></div>

From the Sending Domains menu, you can also delete the domains, subdomains, or the demo domain you no longer use. Just press the bin icon next to the domain. This will remove the domain from the list, and you won't be able to send any further emails until you add and verify it again.

<div align="left" data-with-frame="true"><figure><img src="/files/kkLGgPLZiUSMYyKY65lp" alt="Sending Domains with delete button highlighted" width="563"><figcaption></figcaption></figure></div>

Note that removing a domain won't remove it from your Mailtrap account completely. It will still appear, for example, in analytics, and will be displayed with the (deleted) suffix, just like in the example below:

<div align="left" data-with-frame="true"><figure><img src="/files/hhm6Qx4ZIgxgrWX0FxTu" alt="Stats overview showing deleted domains with (deleted) suffix" width="375"><figcaption></figcaption></figure></div>

We do this to preserve your historical stats that would otherwise be lost.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mailtrap.io/email-api-smtp/setup/sending-domain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
