This is a update and rewrite of the first script. Please read:
http://forum.mratwork.com/kloxo-mr-tips-and-tricks/sendmail-userid-usage-limits-(script-v1-0b)/The idea behind this update is no longer to send the mail piped line by line to the original sendmail. Malformed email, or an extra carriage return/enter was causing the script to halt and not send. To overcome this, I use a bash script to check with our database (OK to send mail) and then pipe it directly to the qmail sendmail program. It gets it unaltered. If a limit is reached, it simply doesn't pass it to the qmail sendmail.
This also made it faster, and under load, it performs better. The logging has been changed, and can be either on or off. It will log the time, working directory of the script which invoked it, user, user id, current count / Max count, and status.
If you already installed v1.0 you do not have to redo the SQL, but the configuration file and all else have changed. Right before running the new install script, issue this command
rm -rf /usr/sbin/sendmailwrapper
Install is
cd /tmp
wget http://cc-server1.us/sendmail_wrapper20140219.zip
unzip sendmail_wrapper20140219.zip
./smw_install.sh
Log can be found at: /var/log/sendmail-limits.log and is rotated automatically daily, saving previous 10.
Read the txt file for details BEFORE running the install script, configuration is easy. Again, report any issues. This is a must for a shared hosting environment.
Enjoy!