When you ran telnet mail.mydomain.com 25
and received the following output:
Trying 127.0.0.1...
Connected to mail.mydomain.com.
Escape character is '^]'.
This indicates that:
- The Postfix service is running and listening on port 25
- The basic networking connectivity is working
- However, Postfix isn't responding with the expected SMTP banner
The issue likely stems from one of these scenarios:
# Check if Postfix is running
sudo systemctl status postfix
# Verify listening ports
sudo netstat -tulnp | grep postfix
# or alternatively
sudo ss -tulnp | grep postfix
Package updates sometimes reset configuration files. Verify these critical files:
# Main configuration file
sudo nano /etc/postfix/main.cf
# Check for these essential parameters:
myhostname = mail.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
After verifying the configuration, test SMTP with these commands:
# Basic SMTP test
telnet localhost 25
EHLO localhost
MAIL FROM: test@mydomain.com
RCPT TO: validuser@mydomain.com
DATA
Subject: Test email
This is a test message.
.
QUIT
# Check mail logs in real-time
sudo tail -f /var/log/mail.log
Ubuntu 11.04 might have these issues:
# Check firewall rules
sudo iptables -L
# Temporary disable firewall for testing
sudo ufw disable
# SELinux commands (if applicable)
sudo getenforce
sudo setenforce 0
For upgrade-related issues, try:
# Reconfigure postfix
sudo dpkg-reconfigure postfix
# Check package dependencies
sudo apt-cache depends postfix
# Reinstall if necessary
sudo apt-get install --reinstall postfix
Beyond telnet, consider these utilities:
# Using swaks for advanced testing
swaks --to user@example.com --server mail.mydomain.com
# Check DNS records
dig MX mydomain.com
dig A mail.mydomain.com
When you ran telnet mail.mydomain.com 25
, the connection was established (as shown by "Connected to mail.mydomain.com"), but the SMTP banner didn't appear. This suggests Postfix is running but not responding properly. Here's what a healthy response should look like:
220 mail.mydomain.com ESMTP Postfix (Ubuntu)
Recent package updates might have affected:
- Configuration file locations or permissions
- Dependencies (like libssl or libdb)
- Service initialization
First check Postfix's status and logs:
sudo service postfix status
sudo tail -n 50 /var/log/mail.log
Common log errors post-upgrade include:
postfix/master[pid]: fatal: bind 127.0.0.1 port 25: Permission denied
postfix/postdrop: warning: unable to drop privileges: Permission denied
Check your main Postfix configuration:
postconf -n
Key parameters to verify:
inet_interfaces = all
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
smtpd_banner = $myhostname ESMTP $mail_name
Check if Postfix is actually listening on port 25:
sudo netstat -tulpn | grep :25
sudo ss -tulpn | grep :25
You should see output similar to:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1234/master
After verifying the above, try a full SMTP conversation:
telnet localhost 25
EHLO example.com
MAIL FROM: <test@example.com>
RCPT TO: <youruser@mydomain.com>
DATA
Subject: Test email
This is a test message.
.
QUIT
For Ubuntu 11.04 (now EOL), you might encounter:
- Obsolete dependency chains
- Incompatible library versions
- Missing configuration during upgrade
Consider checking package integrity:
sudo dpkg --verify postfix
sudo apt-get install --reinstall postfix
For comprehensive testing, use swaks (Swiss Army Knife for SMTP):
swaks --to user@mydomain.com --from tester@example.com --server mail.mydomain.com
This provides detailed SMTP transaction logging and is more reliable than manual telnet tests.