# Domain Not Allowed

### Error Message

```
Error: Mail command failed: 550 5.7.1 Sending from domain is not allowed
```

This error occurs when you try to send an email using SMTP with a domain that doesn't match your verified domain in Mailtrap.

### Common Causes

**1. Domain Mismatch**

You're sending an email with `FROM: {anything}@mydomain.com`, but in Mailtrap, you've verified `anotherdomain.com`.

**The verified domain and FROM domain in your emails must match.**

{% hint style="warning" %}
If you verified `example.com` in Mailtrap, you can only send emails from `*@example.com` addresses.
{% endhint %}

**2. Domain Not Verified or Compliance Check Failed**

Your domain might not be fully verified, or you haven't passed the Compliance Check.

### How to Fix

{% stepper %}
{% step %}
**Check Your Verified Domains**

Go to [Sending Domains](https://mailtrap.io/domains) in your Mailtrap account.
{% endstep %}

{% step %}
**Verify Domain Status**

Look for the **Verified** badge next to your domain. If you don't see it:

1. Click on the domain
2. Check if all DNS records are found by Mailtrap (all should be green)
3. If any records are missing or incorrect, update them with your DNS provider
   {% endstep %}

{% step %}
**Check Compliance Status**

Scroll down to see the **Compliance Check** status.

If the compliance check hasn't passed:

* Review any additional steps required
* Complete any pending actions
* Wait for the check to complete
  {% endstep %}

{% step %}
**Update Your FROM Address**

Ensure your application sends emails from an address that matches your verified domain:

* **Correct:** `noreply@yourdomain.com` (if `yourdomain.com` is verified)
* **Incorrect:** `noreply@otherdomain.com` (if `otherdomain.com` is not verified)
  {% endstep %}
  {% endstepper %}

### Related Articles

* [Sending Domain Setup](/email-api-smtp/setup/sending-domain.md)
* [SMTP Integration](/email-api-smtp/setup/smtp-integration.md)
* [Unauthorized Error (401 Code)](/email-api-smtp/help/troubleshooting/unauthorized-401-error.md)


---

# 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/help/troubleshooting/sending-from-domain-not-allowed.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.
