How to Configure Host Mail and SPF Records in Plesk When DNS Is Externally Hosted Make it Rain Paper

  • DNS, DNS Configuration, DNS Management
  • 0

Pre-requirements

  • Administrator access to Plesk control panel.
  • Access to your external DNS provider's control panel (e.g., GoDaddy, Namecheap, etc.).
  • Basic knowledge of DNS records and mail configuration.
  • The Plesk server IP address for creating the required DNS records.

Introduction

When your DNS is hosted externally but mail is hosted on a Plesk server, you need to configure DNS records manually to ensure proper mail flow and spam protection. This guide explains how to configure the mail records, SPF, and autodiscovery SRV records in an external DNS system to work seamlessly with Plesk.

Step 1: Configuring Mail Records in External DNS

To route emails correctly to your Plesk server when the DNS is hosted externally, you need to create MX and A records for the mail server.

DNS Records to Create

    • MX Record for mail delivery:
example.com. MX (10) mail.example.com.
    • A Record for the mail server:
mail.example.com. A $localServer.IP
    • A Record for webmail access (if using webmail):
webmail.example.com. A $localServer.IP

Note: Replace $localServer.IP with your actual Plesk server IP address.

Step 2: Configuring SPF Records

SPF (Sender Policy Framework) is essential for email authentication to prevent your emails from being marked as spam. If an SPF record does not already exist for your domain, you need to create one.

SPF Record to Create

    • TXT Record for SPF:
example.com. TXT v=spf1 +a +mx ip4:$localServer.IP -all

Explanation:

  • +a: Authorizes the domain's A record.
  • +mx: Authorizes mail sent from your MX records.
  • ip4:$localServer.IP: Specifies the Plesk server IP as an authorized sender.
  • -all: Denies all other senders.

Note: Replace $localServer.IP with your actual Plesk server IP address.

Step 3: Configuring Autodiscovery SRV Records

To ensure that email clients can automatically discover the mail server settings, you need to manually create SRV records for IMAP, POP3, and SMTP services in the external DNS.

Autodiscovery SRV Records to Create

    • IMAP over SSL:
_imaps._tcp.example.com. SRV 0 1 993 mail.example.com.
    • POP3 over SSL:
_pop3s._tcp.example.com. SRV 0 1 995 mail.example.com.
    • SMTP over SSL:
_smtps._tcp.example.com. SRV 0 1 465 mail.example.com.

Explanation:

  • _imaps._tcp: Specifies IMAP over TCP protocol.
  • example.com: Replace with your domain name.
  • mail.example.com: Replace with your mail server's hostname.
  • 993, 995, 465: Standard ports for IMAP, POP3, and SMTP over SSL.

Gotchas to Avoid

  • Ensure that the IP addresses in the DNS records point to the correct Plesk server IP address. Misconfiguring the IP can cause mail delivery issues.
  • If there are existing MX or A records for the same services, make sure they are either updated or removed to avoid conflicts.
  • Test the mail configuration thoroughly after making changes by sending and receiving emails and verifying SPF records using dig or an SPF checker tool.

Linux Commands for DNS and SPF Verification

Check MX and A Records

Use dig to verify that the MX and A records are correctly set:

dig MX example.com
dig A mail.example.com

Check SPF Record

Use dig to verify the SPF record for your domain:

dig TXT example.com

Check SRV Records

Use dig to verify the SRV records for mail autodiscovery:

dig SRV _imaps._tcp.example.com
dig SRV _pop3s._tcp.example.com
dig SRV _smtps._tcp.example.com

By following these steps, you can successfully configure mail records, SPF, and autodiscovery for domains where the DNS is hosted externally. Be sure to test all configurations to ensure that mail services function correctly and that SPF is properly set up to prevent email spoofing. For more detailed guidance, visit our Knowledge Base.


Did this answer help?

« Back