# Setting Up Mail Domains in Humanic

The domain management system allows you to configure and verify domains for sending emails through your application. This guide covers everything you need to know about adding, configuring, and managing sender domains.

### Getting Started

A sender domain is a domain you own that's used to send emails from your application (e.g., <notifications@yourdomain.com>). You need it to:

* Establish trust with email providers
* Improve email deliverability rates
* Comply with email authentication standards
* Avoid emails being marked as spam

#### Prerequisites

* You must own the domain you want to configure
* Access to your domain provider's DNS management panel (e.g., GoDaddy, Namecheap, Cloudflare)
* Administrative permissions in your application

#### Accessing Domain Settings

Navigate to [**Sender Settings**](https://app.humanic.ai/domains/dns/) in your dashboard to view and manage your domains.

### Adding a New Domain

#### Step 1: Create Domain

1. Click the **"Add Domain"** button in the Sender Settings page
2. Fill in the required information:
   * **Domain Name**: Enter your domain (e.g., `example.com`)
   * **Region**: Select the region closest to your location. We use the servers at this location to send out emails.
   * Configure tracking options (optional)

#### Step 2: Required Fields

| Field          | Description                              | Required   |
| -------------- | ---------------------------------------- | ---------- |
| Domain Name    | The domain you own (e.g., `example.com`) | ✅ Yes      |
| Region         | AWS region for email sending             | ✅ Yes      |
| Open Tracking  | Track when users open emails             | ❌ Optional |
| Click Tracking | Track when users click links             | ❌ Optional |

#### Available Regions

* **North Virginia (us-east-1)** - Best for North America
* **Ireland (eu-west-1)** - Best for Europe
* **São Paulo (sa-east-1)** - Best for South America
* **Tokyo (ap-northeast-1)** - Best for Asia Pacific

> **💡 Tip**: Choose the region nearest to your primary audience for optimal email delivery performance.

### Domain Configuration Options

#### Tracking Settings

**Open Tracking**

* **Purpose**: Tracks when recipients open your emails
* **Default**: Enabled
* **Privacy**: Consider recipient privacy preferences

**Click Tracking**

* **Purpose**: Tracks when recipients click links in emails
* **Default**: Enabled
* **Note**: Links are wrapped with tracking URLs

### DNS Records Setup

After creating a domain, you'll need to add DNS records to your domain provider to verify ownership and enable email sending.

#### Required DNS Record Types

**SPF (Sender Policy Framework)**

* **Type**: TXT Record
* **Purpose**: Specifies which mail servers are authorized to send emails from your domain
* **Prevents**: Email spoofing and improves deliverability

**DKIM (DomainKeys Identified Mail)**

* **Type**: TXT Record
* **Purpose**: Adds a digital signature to verify emails haven't been tampered with during transit
* **Benefits**: Improves email authentication and deliverability

**DMARC (Domain-based Message Authentication)**

* **Type**: TXT Record
* **Purpose**: Tells receiving servers how to handle emails that fail SPF or DKIM checks
* **Policy**: Defines actions for failed authentication

**MX (Mail Exchange)**

* **Type**: MX Record
* **Purpose**: Specifies the mail server responsible for receiving emails for your domain
* **Priority**: Lower numbers indicate higher priority

**CNAME (Canonical Name)**

* **Type**: CNAME Record
* **Purpose**: Creates an alias that points to another domain name
* **Usage**: Often used for tracking and bounce handling

#### Adding DNS Records

1. **Copy Records**: Copy the DNS records from the domain details table
2. **Access DNS Settings**: Log into your domain provider's control panel
3. **Navigate to DNS**: Find the DNS management or DNS records section
4. **Add Records**: Create new records with the exact values provided
5. **Save Changes**: Apply the DNS changes

#### Common Domain Providers

| Provider           | DNS Management Location             |
| ------------------ | ----------------------------------- |
| **GoDaddy**        | Domain Manager → DNS Management     |
| **Namecheap**      | Domain List → Manage → Advanced DNS |
| **Cloudflare**     | DNS → Records                       |
| **Google Domains** | DNS → Custom Records                |
| **AWS Route 53**   | Hosted Zones → Record Sets          |

### Domain Verification Process

#### Verification Steps

1. **Add DNS Records**: Configure all required DNS records in your domain provider
2. **Wait for Propagation**: DNS changes typically take 5-10 minutes (up to 24 hours)
3. **Click Verify**: Use the "Verify" button to check domain configuration
4. **Monitor Status**: Check verification status and refresh as needed

#### Domain Status Types

| Status          | Description                                                                  | Action Required                          |
| --------------- | ---------------------------------------------------------------------------- | ---------------------------------------- |
| **Not started** | You’ve added a domain to Humanic, but you haven’t clicked on `Verify` button | Add DNS records and click `Verify`       |
| **Pending**     | Humanic is trying to verify the dns records.                                 | Wait a bit and click `Refresh`           |
| **Verified**    | Domain fully configured and ready to send out emails                         | None - ready to send                     |
| **Failed**      | Verification failed due to missing/incorrect DNS records                     | Check DNS records using DNS lookup tools |

#### Verification Timeline

* **Immediate**: DNS record detection (if properly configured)
* **5-10 minutes**: Typical DNS propagation time
* **Up to 24 hours**: Maximum DNS propagation time globally
* **Manual refresh**: Use "Refresh" button to check status updates

#### DNS Verification Tools

Use these tools to verify your DNS records independently:

* **dig** command: `dig TXT _dmarc.yourdomain.com`
* **nslookup**: `nslookup -type=TXT yourdomain.com`
* **Online tools**: MXToolbox, DNSChecker, WhatsMyDNS

#### Getting Help

If you continue experiencing issues:

1. Check DNS records using external tools
2. Verify domain ownership with your provider
3. Review error messages in the application
4. Contact support with specific error details

### Best Practices

#### Domain Selection

* Use a subdomain for transactional emails (e.g., `mail.yourdomain.com`)
* Keep marketing and transactional domains separate
* Choose memorable, professional domain names

#### DNS Configuration

* **Double-check values**: Copy DNS records exactly as provided
* **Use proper TTL**: Set reasonable TTL values (300-3600 seconds)
* **Monitor regularly**: Check domain status periodically
* **Keep records updated**: Update DNS when changing email providers

#### Performance Optimization

* **Choose nearby regions**: Select regions close to your audience
* **Monitor deliverability**: Track email delivery rates
* **Warm up domains**: Gradually increase sending volume for new domains
* **Maintain reputation**: Follow email best practices and use tools like postmaster to track your domain reputation

#### Compliance

* **Privacy laws**: Consider GDPR, CAN-SPAM compliance
* **Tracking consent**: Obtain consent for email tracking
* **Unsubscribe options**: Provide clear unsubscribe mechanisms
* **Data retention**: Follow data retention policies

### Next Steps

Once your mail domain is configured and DNS settings are verified:

* **Run Email Campaigns**: Start sending [email campaigns](https://app.humanic.ai/) to your users.
* **Track Performance**: Use Humanic to monitor campaign performance.

### FQAs

<details>

<summary>How long does it take to verify my domain?</summary>

Domain verification typically takes 5-10 minutes after adding DNS records to your domain provider, but can take up to 24 hours for global DNS propagation. If verification is still pending after 30 minutes, click "Refresh" to check the status or use online DNS tools to verify your records are properly configured.

</details>

<details>

<summary>What to do if domain is not getting verified?</summary>

If your domain is not getting verified, the DNS records might be missing or incorrect. Double-check that you've copied all DNS record values exactly as shown (no extra spaces or missing characters), ensure they're published in your domain provider's DNS settings, and wait at least 10 minutes before clicking "Verify" again. [Check your DNS records here](https://www.dnschecker.org).

</details>
