114 lines
3.3 KiB
Markdown
114 lines
3.3 KiB
Markdown
# Email Blocking Diagnostic Tool
|
|
|
|
This document explains how to diagnose and fix email blocking issues in the d-mail system.
|
|
|
|
## Problem
|
|
|
|
A client (`r.sadat@humapek.co`) cannot receive emails from `russel.s@metixco.ae`, but can receive emails from other senders.
|
|
|
|
## Solution
|
|
|
|
A diagnostic endpoint has been added to check if a sender domain is blocked and optionally unblock it.
|
|
|
|
## Usage
|
|
|
|
### Check if a domain is blocked (Diagnostic Mode)
|
|
|
|
```bash
|
|
GET /email/diagnose-blocking?recipient=r.sadat@humapek.co&senderDomain=metixco.ae
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"recipientEmail": "r.sadat@humapek.co",
|
|
"senderDomain": "metixco.ae",
|
|
"user": {
|
|
"id": "user-id",
|
|
"email": "r.sadat@humapek.co",
|
|
"wildduckUserId": "wildduck-user-id",
|
|
"businessId": "business-id"
|
|
},
|
|
"domainTag": "business-id",
|
|
"blocked": true,
|
|
"blockedDomains": [
|
|
{
|
|
"domain": "metixco.ae",
|
|
"description": "Auto-blocked due to spam report",
|
|
"created": "2024-01-01T00:00:00Z"
|
|
}
|
|
],
|
|
"blockingFilters": [],
|
|
"message": "Domain metixco.ae is blocked. Use unblock=true to unblock it."
|
|
}
|
|
```
|
|
|
|
### Unblock a domain
|
|
|
|
```bash
|
|
GET /email/diagnose-blocking?recipient=r.sadat@humapek.co&senderDomain=metixco.ae&unblock=true
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"recipientEmail": "r.sadat@humapek.co",
|
|
"senderDomain": "metixco.ae",
|
|
"user": { ... },
|
|
"domainTag": "business-id",
|
|
"blocked": false,
|
|
"unblocked": true,
|
|
"message": "Domain metixco.ae has been unblocked successfully"
|
|
}
|
|
```
|
|
|
|
## Authentication
|
|
|
|
This endpoint requires **Admin authentication**. Make sure you're authenticated as an admin user.
|
|
|
|
## How It Works
|
|
|
|
1. **Finds the recipient user** by email address
|
|
2. **Determines the domain tag** (usually the business ID, or "default")
|
|
3. **Checks blocked domains** for that domain tag
|
|
4. **Checks email filters** that might be blocking emails from the sender domain
|
|
5. **Optionally unblocks** the domain if requested
|
|
|
|
## Common Causes
|
|
|
|
1. **Domain Blocking**: The sender domain was marked as spam and automatically blocked
|
|
2. **Email Filters**: User-created filters that delete or mark as spam emails from specific domains
|
|
3. **WildDuck Configuration**: Server-level blocking (less common)
|
|
|
|
## Troubleshooting
|
|
|
|
If the domain is not blocked but emails still aren't arriving:
|
|
|
|
1. Check the sender's email server logs
|
|
2. Check WildDuck server logs
|
|
3. Verify DNS/MX records for both domains
|
|
4. Check if there are any forwarding rules
|
|
5. Verify the recipient's email quota isn't exceeded
|
|
|
|
## Example: Fix the Current Issue
|
|
|
|
To fix the issue with `r.sadat@humapek.co` not receiving emails from `russel.s@metixco.ae`:
|
|
|
|
```bash
|
|
# First, check the status
|
|
curl -X GET "http://your-api-url/email/diagnose-blocking?recipient=r.sadat@humapek.co&senderDomain=metixco.ae" \
|
|
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
|
|
|
|
# If blocked, unblock it
|
|
curl -X GET "http://your-api-url/email/diagnose-blocking?recipient=r.sadat@humapek.co&senderDomain=metixco.ae&unblock=true" \
|
|
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
|
|
```
|
|
|
|
## Notes
|
|
|
|
- The domain tag is typically the business ID of the recipient user
|
|
- If a user doesn't have a business, the domain tag defaults to "default"
|
|
- Unblocking a domain affects all users in the same business (same domain tag)
|
|
- The diagnostic also checks for email filters that might be blocking emails
|
|
|