Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Postfix Can Send But Not Receive Email: Troubleshooting

· 6 min read · Home Tech

In this article
  1. How Postfix Receives Email
  2. Step 1: Check the MX Record
  3. Step 2: Verify Postfix Is Listening on Port 25
  4. Step 3: Test Locally with Telnet
  5. Step 4: Test from Outside the Server
  6. Step 5: Check for NAT or Port Forwarding
  7. Step 6: Verify Postfix Accepts the Mail
  8. Frequently Asked Questions

If your Postfix mail server can send email but cannot receive it, the problem is almost always one of three things: the mail server is not listening on port 25, a firewall is blocking inbound connections on port 25, or the MX (Mail Exchanger) DNS record does not point to your server's public IP address. This guide walks through each of those causes in order, from the most common to the least, with exact commands to diagnose and fix the issue.

How Postfix Receives Email

Postfix receives email by listening on TCP port 25 (SMTP) for incoming connections from other mail servers. When a remote server wants to deliver mail to your domain, it looks up the MX record for your domain, connects to the IP address that record points to, and then speaks the SMTP protocol. For that to work, four things must all be true:

  • The MX record for your domain must point to a hostname that resolves to your server's public IP.
  • Your server's firewall must allow inbound TCP connections on port 25.
  • Postfix must be running and listening on port 25 (or on a port that your firewall forwards to 25).
  • Postfix must accept the message (not reject it due to relay restrictions or recipient validation).

If any one of those fails, mail sent to your domain will bounce or sit in the sender's queue. Sending email works through a different path — outbound connections to other servers' port 25 — so a problem with inbound port 25 does not affect your ability to send.

Step 1: Check the MX Record

Before touching the server, verify that the domain's MX record actually points to your server. Use the dig command from any machine with DNS tools installed:

dig MX example.com

Look for a line like example.com. 3600 IN MX 10 mail.example.com.. The hostname in that record (mail.example.com) must then resolve to your server's public IP:

dig A mail.example.com

If the MX record is missing, points to the wrong hostname, or the hostname resolves to a different IP, that is the problem. Fix it in your DNS provider's control panel. Common mistakes include:

  • Using an IP address directly in the MX record (not allowed by the RFC; must be a hostname).
  • Pointing the MX record to a hostname that has no A record.
  • Leaving the MX record pointing to an old server after migrating.

DNS changes can take time to propagate, so after updating, wait a few minutes and re-check with dig.

Step 2: Verify Postfix Is Listening on Port 25

On the server itself, check whether Postfix is actually bound to port 25. Run:

ss -tlnp | grep :25

You should see a line like LISTEN 0 100 0.0.0.0:25 or [::]:25. If nothing appears, Postfix is not running or is configured to listen on a different port. Check the service status:

systemctl status postfix

If it is not running, start it: systemctl start postfix. If it is running but not listening on 25, check the inet_interfaces and mynetworks settings in /etc/postfix/main.cf. The default inet_interfaces = all makes Postfix listen on all interfaces. If you set it to a specific IP, make sure that IP is the server's public IP.

Step 3: Test Locally with Telnet

Once Postfix is listening, test locally to confirm it accepts connections. From the server itself, run:

telnet localhost 25

You should see a banner like 220 mail.example.com ESMTP Postfix. Type quit to exit. If that works, the issue is not Postfix itself but something between the server and the internet (firewall, NAT, or hosting provider).

Step 4: Test from Outside the Server

Next, test from a different machine on the internet. Use a web-based SMTP port checker or run telnet from another server:

telnet mail.example.com 25

If the connection times out or is refused, a firewall is blocking port 25. Check the server's firewall rules. On most Linux systems with ufw:

sudo ufw status

If port 25 is not allowed, add it:

sudo ufw allow 25/tcp

If you use iptables directly, check with sudo iptables -L -n. Also check your hosting provider's firewall or security group settings — many cloud providers block port 25 by default to prevent spam. You may need to open it in the provider's control panel.

Step 5: Check for NAT or Port Forwarding

If your server is behind a home or office router, the router must forward inbound TCP port 25 to the server's internal IP. Without that port forward, external connections never reach the server. Log into your router's admin page and look for “Port Forwarding” or “Virtual Server” settings. Create a rule that forwards external port 25 to the internal IP of your Postfix server, also on port 25.

Also confirm the server's internal IP is static, or set a DHCP reservation, so the port forward always points to the right machine.

Step 6: Verify Postfix Accepts the Mail

Even if the connection succeeds, Postfix may reject the email itself. Check the mail logs:

tail -f /var/log/mail.log

Then try sending a test email from an external account. Look for lines like NOQUEUE: reject: RCPT from .... Common rejection reasons:

  • Relay access denied — Postfix is configured to reject mail that is not for local domains. Make sure your domain is listed in mydestination in main.cf.
  • User unknown — The recipient address does not exist. If you want to catch all mail, add luser_relay or use a catch-all alias.
  • Client host rejected — Your server uses smtpd_client_restrictions that block certain IP ranges. Check those settings.

Frequently Asked Questions

Why can I send email but not receive it?

Because sending uses outbound connections (your server connects to other servers on port 25), while receiving requires inbound connections on port 25. Your outbound connection works, but something is blocking or misdirecting the inbound one — usually DNS, firewall, or port forwarding.

How do I check if port 25 is open on my server?

From outside, use a port checker tool or run telnet mail.example.com 25 from another machine. From the server itself, run ss -tlnp | grep :25 to see if Postfix is listening.

My MX record is correct, but mail still doesn't arrive. What next?

Check the firewall on the server and at the hosting provider. Many cloud providers block port 25 by default. Also verify that the A record for the hostname in the MX record points to the correct public IP.

Can I receive mail on a different port?

Technically yes, but not standard SMTP. Port 25 is the standard for mail exchange. If you use a non-standard port, you would need to configure your mail client to use that port, and other servers would still try port 25. It's not a practical solution for normal email.

What does "Relay access denied" mean in the logs?

It means Postfix received a connection but refused to accept the email because the sender is not allowed to relay through your server. For incoming mail to your own domain, make sure your domain is in the mydestination setting. If you are trying to send through your server from an external client, you need to configure SASL authentication.

How long does DNS propagation take after changing MX records?

It varies, but usually from a few minutes to 48 hours. You can check the TTL (time-to-live) on the old record to estimate. Use dig MX example.com to see the current value from your location.