Just added some comments and did some clean-up to spoil my OCD. Still more to be done (it never ends).
&send_report is now capable of sending the HTML reports with the correct MIME type
Changed schema of SQLite systems table and removed messages table. &diagnose subroutine now works and the HTML template is being populated accordingly since. Inserted diagnostic subroutine &check_esl_status. Changed &publish (formerly known as &send_report) to allow multiple recipients. Database subroutine that perform SELECT statement now return a reference to an array of references to hashes. I should've committed more than once :S