User Tools

Site Tools


email:dns-configuration:mx-records

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

email:dns-configuration:mx-records [2026/08/03 13:25] – created - external edit 127.0.0.1email:dns-configuration:mx-records [2026/08/03 13:29] (current) – external edit 127.0.0.1
Line 1: Line 1:
-MX Records (Mail Exchanger)+====== MX Records (Mail Exchanger) ======
  
 A **Mail Exchanger (MX) Record** is a type of Resource Record in the Domain Name System (DNS) that specifies the mail server responsible for accepting email messages on behalf of a domain name. A **Mail Exchanger (MX) Record** is a type of Resource Record in the Domain Name System (DNS) that specifies the mail server responsible for accepting email messages on behalf of a domain name.
Line 5: Line 5:
 Without valid MX records, sending servers cannot locate your mail infrastructure, causing incoming emails to bounce or fail delivery. Without valid MX records, sending servers cannot locate your mail infrastructure, causing incoming emails to bounce or fail delivery.
  
----+----
  
-## How MX Records Work+===== How MX Records Work =====
  
-When someone sends an email to `user@example.com`, the sender's mail transfer agent (MTA) performs the following steps:+When someone sends an email to ''user@example.com'', the sender's mail transfer agent (MTA) performs the following steps:
  
-1. **DNS Lookup:** Queries DNS for the `MXrecords associated with `example.com`+  # **DNS Lookup:** Queries DNS for the ''MX'' records associated with ''example.com''
-2. **Priority Resolution:** Sorts the returned MX hostnames by their preference (priority) number. +  # **Priority Resolution:** Sorts the returned MX hostnames by their preference (priority) number. 
-3. **A/AAAA Lookup:** Resolves the primary MX hostname to an IP address (`Aor `AAAArecord). +  # **A/AAAA Lookup:** Resolves the primary MX hostname to an IP address (''A'' or ''AAAA'' record). 
-4. **SMTP Connection:** Attempts an SMTP connection to the primary mail server on port `25`. If the primary server is unreachable, it attempts to connect to secondary backup servers in order of priority.+  # **SMTP Connection:** Attempts an SMTP connection to the primary mail server on port ''25''. If the primary server is unreachable, it attempts to connect to secondary backup servers in order of priority.
  
----+----
  
-## MX Record Structure & Parameters+===== MX Record Structure & Parameters =====
  
 An MX record consists of three core components: An MX record consists of three core components:
  
-Component Value Example Description +Component Value Example Description ^ 
-| :--- | :--- | :--- | +| **Name / Host** | ''@'' or ''example.com'' | The domain name receiving the email. | 
-| **Name / Host** | `@or `example.com| The domain name receiving the email. | +| **Preference / Priority** | ''10'' | Integer value indicating server priority (lower numbers = higher priority). | 
-| **Preference / Priority** | `10| Integer value indicating server priority (lower numbers = higher priority). | +| **Mail Server / Target** | ''mail.example.com'' | The Fully Qualified Domain Name (FQDN) of the mail server. |
-| **Mail Server / Target** | `mail.example.com| The Fully Qualified Domain Name (FQDN) of the mail server. |+
  
-> **Crucial Rule:** The target of an MX record **MUST** point to a valid domain name (`Aor `AAAArecord). It **must never** point directly to an IP address or a `CNAMEalias.+> **Crucial Rule:** The target of an MX record **MUST** point to a valid domain name (''A'' or ''AAAA'' record). It **must never** point directly to an IP address or a ''CNAME'' alias.
  
----+----
  
-## MX Record Priority Explained+===== MX Record Priority Explained =====
  
 Priorities allow domain administrators to set up primary and backup fallback mail servers. Priorities allow domain administrators to set up primary and backup fallback mail servers.
  
-```text+<code>
 Priority 10 : mail1.example.com  <-- Primary Mail Server (Tried First) Priority 10 : mail1.example.com  <-- Primary Mail Server (Tried First)
 Priority 20 : mail2.example.com  <-- Secondary / Backup Server (Tried if Priority 10 fails) Priority 20 : mail2.example.com  <-- Secondary / Backup Server (Tried if Priority 10 fails)
 +</code>
  
-```+  * **Equal Priorities:** If multiple servers share the same priority (e.g., two servers with priority ''10''), incoming mail load is distributed between them (round-robin / load balancing). 
 +  * **Lower Number = Higher Preference:** Priority ''5'' takes precedence over Priority ''10''.
  
-* **Equal Priorities:** If multiple servers share the same priority (e.g., two servers with priority `10`), incoming mail load is distributed between them (round-robin / load balancing). +----
-* **Lower Number = Higher Preference:** Priority `5` takes precedence over Priority `10`.+
  
----+===== Example Configurations =====
  
-## Example Configurations+==== Example 1: Standard Self-Hosted Mail Server ====
  
-### Example 1: Standard Self-Hosted Mail Server+^ Record Type ^ Host ^ Priority ^ Value / Target ^ TTL ^ 
 +| **MX** | ''@'' | 10 | ''mail.example.com.'' | 3600 | 
 +| **A** | ''mail'' | — | ''192.0.2.25'' | 3600 |
  
-| Record Type | Host | Priority | Value / Target | TTL | +==== Example 2: Google Workspace Configuration ====
-| --- | --- | --- | --- | --- | +
-| **MX** | `@` | `10` | `mail.example.com.` | `3600` | +
-| **A** | `mail` | — | `192.0.2.25` | `3600` |+
  
-### Example 2: Google Workspace Configuration+^ Record Type ^ Host ^ Priority ^ Value / Target ^ TTL ^ 
 +| **MX** | ''@'' | 1 | ''SMTP.GOOGLE.COM.'' | 3600 |
  
-| Record Type | Host | Priority | Value / Target | TTL | +----
---- --- | --- | --- | --- | +
-| **MX** | `@` | `1` | `SMTP.GOOGLE.COM.` | `3600` |+
  
----+===== Common Issues & Troubleshooting =====
  
-## Common Issues & Troubleshooting +==== 1. Pointing MX Records to CNAMEs ==== 
- +Pointing an MX record to a target that is a CNAME alias violates [[https://datatracker.ietf.org/doc/html/rfc2181|RFC 2181 (Section 10.3)]] and can lead to unpredictable mail loop errors or bounced emails.
-### 1. Pointing MX Records to CNAMEs +
- +
-Pointing an MX record to a target that is a CNAME alias violates [RFC 2181 (Section 10.3)](https://datatracker.ietf.org/doc/html/rfc2181) and can lead to unpredictable mail loop errors or bounced emails. +
- +
-### 2. Pointing MX Records directly to IP Addresses+
  
 +==== 2. Pointing MX Records directly to IP Addresses ====
 MX records require an FQDN as their target. Pointing directly to an IPv4/IPv6 address will cause syntax validation failures across major mail servers. MX records require an FQDN as their target. Pointing directly to an IPv4/IPv6 address will cause syntax validation failures across major mail servers.
  
-### 3. Missing Trailing Dot (in Raw Zone Files)+==== 3. Missing Trailing Dot (in Raw Zone Files) ==== 
 +In raw DNS zone files, failing to append a trailing dot (''mail.example.com.'') may cause DNS servers to append the root domain twice (''mail.example.com.example.com'').
  
-In raw DNS zone files, failing to append a trailing dot (`mail.example.com.`) may cause DNS servers to append the root domain twice (`mail.example.com.example.com`).+----
  
---- +===== Verification & Testing =====
- +
-## Verification & Testing+
  
 You can test and verify your MX records using **Telenegar Tools** or terminal commands: You can test and verify your MX records using **Telenegar Tools** or terminal commands:
  
-### Using Telenegar Tools+==== Using Telenegar Tools ==== 
 +  * **DNS Resolution:** Check MX lookup propagation with the [[tools:dnscheck|Telenegar DNS Check Tool]]. 
 +  * **Mail Server Health:** Run a complete deliverability scan with the [[tools:mailcheck|Telenegar Mail Check Tool]].
  
-Validate your domain's mail exchanger configuration using [Telenegar DNS Check](https://wiki.telenegar.ir/doku.php%3Fid%3Dtools:dnscheck) or [Telenegar Mail Check](https://wiki.telenegar.ir/doku.php%3Fid%3Dtools:mailcheck).+==== Using Terminal Tools ====
  
-### Using Terminal Tools +=== dig (Linux / macOS) === 
- +<code> bash
-#### `dig(Linux / macOS) +
- +
-```bash+
 dig +short example.com MX dig +short example.com MX
 +</code>
  
-``` +=== nslookup (Windows / Cross-platform) === 
- +<code> cmd
-#### `nslookup(Windows / Cross-platform) +
- +
-```cmd+
 nslookup -type=MX example.com nslookup -type=MX example.com
 +</code>
  
-``` +----
- +
---- +
- +
-## Related Documentation+
  
-* [Telenegar DNS Check Tool](https://wiki.telenegar.ir/doku.php?id=tools:dnscheck) — Diagnostic tool for DNS record resolution and propagation. +===== Related Documentation =====
-* [Telenegar Mail Check Tool](https://wiki.telenegar.ir/doku.php?id=tools:mailcheck) — Diagnostic tool for email authentication and mail server health. +
-* [SPF (Sender Policy Framework)](https://wiki.telenegar.ir/doku.php?id=email:dns-configuration:spf) — Protect your domain against email spoofing. +
-* [DKIM (DomainKeys Identified Mail)](https://wiki.telenegar.ir/doku.php?id=email:dns-configuration:dkim) — Add cryptographic signatures to outbound emails. +
-* [DMARC](https://wiki.telenegar.ir/doku.php?id=email:dns-configuration:dmarc) — Define policy rules for SPF and DKIM alignment. +
-* [Reverse DNS (PTR Records)](https://wiki.telenegar.ir/doku.php?id=networking:dns:reverse-dns) — Map mail server IP addresses back to domain names.+
  
-```+  * [[tools:dnscheck|Telenegar DNS Check Tool]] — Diagnostic tool for DNS record resolution and propagation. 
 +  * [[tools:mailcheck|Telenegar Mail Check Tool]] — Diagnostic tool for email authentication and mail server health. 
 +  * [[email:dns-configuration:spf|SPF (Sender Policy Framework)]] — Protect your domain against email spoofing. 
 +  * [[email:dns-configuration:dkim|DKIM (DomainKeys Identified Mail)]] — Add cryptographic signatures to outbound emails. 
 +  * [[email:dns-configuration:dmarc|DMARC]] — Define policy rules for SPF and DKIM alignment. 
 +  * [[networking:dns:reverse-dns|Reverse DNS (PTR Records)]] — Map mail server IP addresses back to domain names.
email/dns-configuration/mx-records.1785763512.txt.gz · Last modified: by 127.0.0.1