Filling in the holes where the system lags a bit, here’s a quick way to get e-mail quota warnings out to your users
So I got bitten this morning by a user who hit their IMAP quota limit and didn’t get any alerts from Mail.app about it, possibly because he reckoned he hadn’t quit Mail.app or logged out of his machine for about a month…
This led me to whip up this PHP script this morning. PHP has kind of become my command line scripting language of choice, mainly because I often find myself needing to read SQL data for one reason or another, it’s installed on all OS X machines, and has a reasonable API for things like sending email.I’ve given up trying to get a PHP site to display in-line PHP properly… so just grab the script from here.
Download the script from here and rename the .txt extension to .php.
You’ll want to customize the various fields at the top, and be warned that if you’re running 10.4 for your mail server, you should replace this line:
exec("sudo -u cyrus /usr/bin/cyrus/bin/quota > /tmp/quotareport");
exec("sudo -u cyrusimap /usr/bin/cyrus/bin/cyrus-quota > /tmp/quotareport");
as the cyrus user name changed from 10.3 to 10.4, as did the executable name.
If you’re just testing this out for the first time, you might want to uncomment out this line:
to print out the details of the over quota users, and also change the $email_to line to have your own address, just so you don’t end up sending bogus emails, like:
$email_to = "[email protected];