Tuesday, November 22, 2016

Exim4 repeatedly sending out the same email

TL;DR: run
rm /var/spool/exim4/db/*




The long version:

A script of mine has been working diligently for months, sending me email when things break, or more often when I purposefully reboot a monitored computer.

This morning it was sending out the same email every few minutes, well after the issue was resolved. While I'm still not sure, I suspect an email was caught in my 'outbox', being sent over and over. In a fit of holiday cheer, I remembered XKCD 838 and looked in /var/spool/ to find a folder called exim4 that was empty except for four files in its db folder. I moved these binary files and the emails stopped. I then sent a test email, and the files immediately reappeared, with the same file sizes the had before. The test email was successfully received, and it's been quiet for hours now.

I don't know what those files do, but I do know that moving/deleting them fixed my problem when a reboot didn't. I didn't find any useful information on Google or in /etc/exim4/conf.d/ so I figured I'd post my findings here.

My problem was with an Ubuntu 16.04.1 server running Exim version 4.86_2 and GNU Mailutils 2.99.99 sending mail via Gmail's SMTP server.
As always: Your Mileage May Vary.