1

I have a single server where mails are processed, and I'd like to use multiple domains.

For example, if the domains were example.com and example2.com, and I had the following DNS records set up:

mail.example.com IN A 1.2.3.4
example.com IN MX mail.example.com

mail.example2.com IN A 1.2.3.4 example2.com IN MX mail.example2.com

4.3.2.1.in-addr.arpa IN PTR mail.example.com

Now if I try to send an email from mail.example2.com, will my emails be rejected due to PTR record mismatch? If so, what'd be the correct DNS configuration for this scenario?

Ar Rakin
  • 121

2 Answers2

1

When configuring an email server to handle multiple domains, ensuring that the PTR record correctly maps to the sending domain is crucial to avoid rejection or marking of emails as spam.

A PTR record (Pointer Record) is used for reverse DNS lookups, mapping an IP address to a domain name. Many mail servers perform a reverse DNS lookup to verify the sending domain, and mismatches can lead to emails being flagged or rejected.

Your current configuration

A Records:

mail.example.com IN A 1.2.3.4

mail.example2.com IN A 1.2.3.4

MX Records:

example.com IN MX mail.example.com

example2.com IN MX mail.example2.com

PTR Record:

4.3.2.1.in-addr.arpa IN PTR mail.example.com

Issue with the Current Setup

With the current setup, any email sent from mail.example2.com will have a reverse DNS lookup result pointing to mail.example.com, causing a mismatch.

To make sure proper operation and avoid email rejection due to PTR record mismatch, you can set the PTR record to a common name that doesn't conflict with either domain or update your SMTP server's HELO/EHLO configuration to match the PTR record. Here are two approaches:

Approach 1: Use a common PTR record name

PTR Record:

4.3.2.1.in-addr.arpa IN PTR mail.example.com (Already set)

Update SMTP Server Configuration:

Configure your mail server to use mail.example.com as the HELO/EHLO name for both domains.

This approach ensures that both example.com and example2.com use the same PTR name, matching the reverse lookup result.

Approach 2: Add Multiple PTR Records (not common practice and usually not supported)

Technically, having multiple PTR records for a single IP is discouraged and not widely supported, as it can cause unpredictable behavior. Instead, it's better to ensure that your SMTP server identifies itself with a single, consistent hostname.

If using Postfix, you can set the hostname it uses in HELO/EHLO using:

smtpd_banner = $myhostname ESMTP $mail_name
myhostname = mail.example.com

That ensures the server identifies as mail.example.com for both domains.

The recommended approach is to ensure that your SMTP server always uses a hostname that matches your PTR record. In your case, configuring the SMTP server to use mail.example.com for HELO/EHLO will prevent any PTR record mismatches, allowing smooth operation for emails sent from both example.com and example2.com.

Sources:

[RFC 1912] - Common DNS Operational and Configuration Errors SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) Documentation

SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) Documentation

Google: Email sender guidelines

Max Haase
  • 1,123
0

Simply use the same MX for both/all domains:

example2.com IN MX mail.example.com

There is no need for a second host name.

Zac67
  • 13,684