Exceeding mail quota
Posted by Mike Haller
on Friday, December 28. 2007
at 17:51
in Hosting
One of my customers of my hosting business called me and was really upset. He wasn't receiving any emails any more. I checked the system, the mailserver and the logs and could not find a problem on our site. Then, i checked the customers email accounts manually. He exceeded his quota on his main email account info@foo.bar (i mention that, because it's a catch-all account and thus receives a lot of spam).I told him that his quota was exceeded and he has to delete old mails to make room for new ones. Unfortunately, he already did that quite regularly. After a talk with the "tech-guy" of the customer, the cause of the problem became pretty obvious: the customer had his own mailserver, which uses fetchmail to gather mails from our mailserver. Our mailserver automatically moves high-level spam into a subfolder of the users mail inbox: "Inbox\Junk". His fetchmail is not configured to retrieve subfolders, so only the inbox was cleared, the Junk folder became bigger and bigger and finally filled the box up to the quota limit.
The user was unaware of that little technical detail, as he also has a "Junk" folder in his mailer application and it was empty according to him.
I solved the problem by automatically deleting mails in the Junk folder which are older than 2 weeks using a simple cron job:
#!/bin/bash
find /var/spool/mail -name ".Junk" -type d | \
xargs -I "%" find % -type f -mtime 14
