If you’re having issues with outgoing mail service in Linux-Qmail server, where all outgoing emails or emails to any specific domain are getting stuck in the remote queue, don’t worry. In this article, we provide a step-by-step solution to resolve the issue.
The article details the issue and error message, as well as provides a resolution that includes checking the Qmail-SMTP routing, verifying connectivity to the host mentioned as a relay, and restarting the Qmail service. We also provide guidance on checking the mail log and Qmail queue to ensure that the mail is being delivered and on how to force-run the mail queue if required.
Read on for simple solutions that will help you deliver emails from your server without any further issues.
The Issue
Outgoing mails getting queued in remote queue with below error in the server mail log (/usr/local/psa/var/log/maillog) :
========== delivery 24075 : deferral: Sorry,_I_wasn't_able_to_establish_an_SMTP_connection._(#4.4.1)/ qmail: xxxxxx.xxxxxxx status: local 0/10 remote 0/20 ==========
Resolution
1] Have a check with the Qmail-SMTP routing
The Qmail-SMTP relay file is /var/qmail/control/smtproutes
# cat /var/qmail/control/smtproutes
#host.com: <IP>
:host3.com
The record `:host3.com` means that all messages, regardless of the destination domain, are relayed to `host3.com`.
host.com: <IP> (if uncommented) means that all messages to the domain ‘host.com’ from the server are relayed through xxx.xxx.xxx.xxx
2] Next, check the connectivity to the host mentioned as relay
We can do a telnet to the SMTP port 25 to verify the connectivity.
# telnet host3.com 25
Trying …
telnet: connect to address <IP>: Connection timed out
telnet: Unable to connect to remote host: Connection timed out
2.1] If the connection is timed out (as above), please, comment out the line with the remote server:
# cat /var/qmail/control/smtproutes
#host.com: <IP>
#:host3.com
2.2] If the connection to the relay host is established, verify that the IP address used to send emails is not blacklisted on the destination host:
# dig mx <destination host>
# telnet <destination mx host> 25
3] Restart Qmail service:
# /etc/init.d/qmail restart
4] Check the maillog and Qmail queue to make sure that mail is being delivered and Qmail queue is decreasing:
# less /usr/local/psa/var/log/maillog
# /var/qmail/bin/qmail-qstat
If required, run the below command to force run the mailqueue.
# kill -ALRM `ps ax | grep [q]mail-send | awk ‘{print $1}’`
The emails should now be delivered immediately from the server !!
If you require help, contact SupportPRO Server Admin