# DNS Configuration Guide for playcoinkrazy.com

This guide provides instructions for setting up DNS records for the playcoinkrazy.com domain to enable email delivery and web hosting.

## Prerequisites

- Domain registrar access (where you purchased playcoinkrazy.com)
- Cloud Run deployment URL (provided by Manus)
- Brevo SMTP configuration details

## DNS Records Required

### 1. A Record (Web Hosting)

**Purpose:** Points your domain to the Cloud Run deployment

| Field | Value |
|-------|-------|
| Type | A |
| Name | @ (root) |
| Value | [Cloud Run IP Address] |
| TTL | 3600 |

**Alternative:** Use CNAME record if your registrar supports it
- CNAME: www → [Cloud Run URL]

### 2. MX Records (Email Delivery)

**Purpose:** Routes email to Brevo SMTP servers

| Priority | Type | Name | Value | TTL |
|----------|------|------|-------|-----|
| 10 | MX | @ | mail.brevo.net | 3600 |
| 20 | MX | @ | mail2.brevo.net | 3600 |

### 3. SPF Record (Email Authentication)

**Purpose:** Authorizes Brevo to send emails on behalf of your domain

| Field | Value |
|-------|-------|
| Type | TXT |
| Name | @ |
| Value | `v=spf1 include:brevo.net ~all` |
| TTL | 3600 |

### 4. DKIM Record (Email Signing)

**Purpose:** Digitally signs emails sent from your domain

| Field | Value |
|-------|-------|
| Type | TXT |
| Name | default._domainkey |
| Value | [DKIM public key from Brevo] |
| TTL | 3600 |

**To get DKIM key:**
1. Log in to Brevo dashboard
2. Go to Settings → Senders & Domains
3. Select playcoinkrazy.com
4. Copy the DKIM public key
5. Add as TXT record with name: `default._domainkey`

### 5. DMARC Record (Email Policy)

**Purpose:** Defines policy for email authentication failures

| Field | Value |
|-------|-------|
| Type | TXT |
| Name | _dmarc |
| Value | `v=DMARC1; p=quarantine; rua=mailto:admin@playcoinkrazy.com` |
| TTL | 3600 |

## Step-by-Step Setup Instructions

### Step 1: Access Your Domain Registrar

1. Log in to your domain registrar (GoDaddy, Namecheap, etc.)
2. Find the DNS management section
3. Locate playcoinkrazy.com

### Step 2: Add A Record for Web Hosting

1. Create new A record
2. Name: @ (or leave blank for root)
3. Value: [Your Cloud Run IP address]
4. TTL: 3600
5. Save

### Step 3: Add MX Records for Email

1. Create first MX record:
   - Priority: 10
   - Name: @ (or leave blank)
   - Value: mail.brevo.net
   - TTL: 3600

2. Create second MX record:
   - Priority: 20
   - Name: @ (or leave blank)
   - Value: mail2.brevo.net
   - TTL: 3600

### Step 4: Add SPF Record

1. Create TXT record
2. Name: @ (or leave blank)
3. Value: `v=spf1 include:brevo.net ~all`
4. TTL: 3600
5. Save

### Step 5: Add DKIM Record

1. Get DKIM key from Brevo:
   - Log in to Brevo
   - Settings → Senders & Domains
   - Select playcoinkrazy.com
   - Copy DKIM public key

2. Create TXT record in your registrar:
   - Name: `default._domainkey`
   - Value: [DKIM key from Brevo]
   - TTL: 3600
   - Save

### Step 6: Add DMARC Record

1. Create TXT record
2. Name: `_dmarc`
3. Value: `v=DMARC1; p=quarantine; rua=mailto:admin@playcoinkrazy.com`
4. TTL: 3600
5. Save

## Verification

### Check DNS Propagation

Use online tools to verify DNS records:
- [MXToolbox](https://mxtoolbox.com)
- [DNS Checker](https://dnschecker.org)
- [Brevo Domain Verification](https://app.brevo.com/settings/domains)

### Verify SPF Record

```bash
dig playcoinkrazy.com TXT
```

Should return: `v=spf1 include:brevo.net ~all`

### Verify MX Records

```bash
dig playcoinkrazy.com MX
```

Should return Brevo MX servers

### Verify DKIM Record

```bash
dig default._domainkey.playcoinkrazy.com TXT
```

Should return your DKIM public key

## Troubleshooting

### Emails Not Sending

1. Check MX records are correctly configured
2. Verify SPF record includes Brevo
3. Ensure DKIM is properly signed
4. Check Brevo dashboard for bounce/complaint rates

### DNS Not Resolving

1. Wait 24-48 hours for DNS propagation
2. Clear browser cache and DNS cache
3. Use `nslookup` or `dig` to verify records
4. Contact your registrar support

### Email Deliverability Issues

1. Check sender reputation in Brevo dashboard
2. Verify DMARC policy is not too strict
3. Monitor bounce and complaint rates
4. Ensure authentication records are correct

## Brevo Configuration

### Verify Domain in Brevo

1. Log in to Brevo dashboard
2. Go to Settings → Senders & Domains
3. Click "Add a domain"
4. Enter: playcoinkrazy.com
5. Complete verification steps
6. Copy DKIM key and add to DNS

### Test Email Sending

1. Go to Campaigns → Create Campaign
2. Select playcoinkrazy.com as sender domain
3. Send test email
4. Verify delivery in Brevo dashboard

## Security Best Practices

1. **Use DMARC policy "quarantine" or "reject"** to prevent spoofing
2. **Monitor DMARC reports** for unauthorized sends
3. **Keep SPF record updated** when adding new email services
4. **Rotate DKIM keys regularly** for security
5. **Enable two-factor authentication** on Brevo account
6. **Review sender reputation** monthly in Brevo dashboard

## Additional Resources

- [Brevo Email Authentication Guide](https://help.brevo.com/hc/en-us/articles/209467485)
- [SPF Record Guide](https://help.brevo.com/hc/en-us/articles/208452485)
- [DKIM Configuration](https://help.brevo.com/hc/en-us/articles/208452545)
- [DMARC Best Practices](https://help.brevo.com/hc/en-us/articles/208452605)

## Support

For issues with:
- **DNS Setup:** Contact your domain registrar
- **Email Delivery:** Contact Brevo support
- **Cloud Run Deployment:** Contact Manus support
