Troubleshooting Mailman Problems

Alex KondratievAlex Kondratiev

3 min read

If you ever had to deal with big mailman lists on busy servers you know that sometimes things can go wrong, mails never make it to the intended recipients, bounces start to pop up everywhere and more. One would imagine that given all the different log files that mailman has there should be sufficient information on them to solve any and all issues but as you probably know already that’s not the case.


This is what you usually see in mailman’s logs

shell

1delivery to user@example.com failed with code -1: (110, 'Connection timed out')
2delivery to user@example.com failed with code -1: (-2, 'Name or service not known')
3delivery to user@example.com failed with code -1: Server not connected
4delivery to user@example.com failed with code -1: (4 , 'Interrupted system call')
5Low level smtp error: (111,'Connection refused')

We can improve that with a simple change: have a mailman log every SMTP transaction.

Open /usr/local/cpanel/3rdparty/mailman/Mailman/Handlers/SMTPDirect.py with your favourite editor and search for:

python

1def __connect(self):
2self.__conn = smtplib.SMTP()
3self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)

Change it to:

python

1def __connect(self):
2self.__conn = smtplib.SMTP()
3self.__conn.set_debuglevel(1)
4self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)

Restart mailman

shell

1/usr/local/cpanel/3rdparty/mailman/bin/mailmanctl restart

You can now check the mailman’s logs

shell

1tail -f /usr/local/cpanel/3rdparty/mailman/logs/*

Now you can debug and troubleshoot any issue by checking these logs.

Alex Kondratiev

Alex Kondratiev

Founder of ITsyndicate. DevOps Enthusiast with 15+ years of experience in cloud, Infrastructure as Code, Kubernetes, and automation. Specialized in architecting secure, scalable, and resilient systems.

Plan the present.
Build the future.