Sending email from a web site using PHP’s mail() function is a pretty routine task. Contact forms, friend requests, alerts, errors… Servers hosting one or two sites the time to send an email is not even noticeable, but on a server that hosts 200+ sites the time creeps up the two to three second range.
In a shared server environment like we have at Wayne State University, we have found there is no easy way to keep track of the emails being sent through php’s mail() function. It would take an analysis of the mail server logs or a friendly sysadmin of another server to alert you if there is a bot taking advantage of a mail() script on your site.
To combat this we are developing an extension for PHPSimpl’s Mail class to instead of send out an email directly to inserts the message into a database and every five minutes a cron runs to send out all emails in the table and records them in a sent table.
This accomplishes:
Making pages load faster, a DB insert is faster than a mail() function.
Frees up server resources to host pages instead of doing sendmail’s.
Determines really how many emails are being sent from the web server.
Keeping track of what sites are sending mail from what pages and by who.
The ability to flag emails before they are sent with keywords like “Viagra” and “Enlargement”.
We are currently just testing the system and hope to include it right into PHPSimpl as a main class but it still needs some stress testing. So far the tests have all came back positive, we have discovered a few of our own forms that have been taken advantage of and we resolved some potential issues.
We also over estimated the amount of emails being sent out, we thought with 200 or so sites it would be ~500-700 emails a day, well it turns out once we fixed a few of the forms we are only sending out ~100 emails a day, not bad.
The graph at the top of the post is the last 5 days and how many emails have been sent out. Today the 6th there has only been 4 emails so far at the time i took the screenshot, 8am.
On the 4th we saw a spike in bot related emails, after some investigation and a few recaptcha additions we just about halved the number of emails the next day.
Next week we hope to have the system fully functional and have a better analysis and report of our findings.
We made it! Well sorta, small steps… PHPSimpl made it to the Del.icio.us PHP popular list. Its a small step but hey any recognition is good recognition.
It have kinda fell off my radar, work has been crazy lately, my development time has been limited due to my new position and this is the perfect thing to kick start my development of it.
I am contemplating changing the name and am in the process of getting approval for the name on Google Code. It may or may not happen but if it does it will bring a true identity to this unknown framework.
BTW, version 0.8.3 is about to be released because of all this and it is the best so far, quite a bit more stable and a few added features.
If there is anything you would like to see added to the project or just want to check it out please feel free to do so. A few ways are:
Just keep adding features So after some time working with the current release we noticed some areas where improvement was needed. So what did we do? We improved in all the wonderful ways below:
Added a debug.log file to debug a live site in real time, best used with “tail -f”
Added the ErrorMessages() function to summarize a forms errors, similar to Rails.
Added the SetConditions() function so querying for >, <, <=, LIKE and OR’s are all possible now.
Added a Get and Set Folder name functions in the Folder Class.
DisplayList() now uses the options of a field to display in the list.
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.
Cleaning up after a release. Thanks to everyone who has been using and testing PHPSimpl. After our first official release we wanted to squash some bugs, here is a list of the updates in 0.8.1:
Slightly Updated Example
Fixed the form label ”?:” issue
Better support for tables without a primary key
Fixed the SimpleFormat to display values properly and renamed it to Nice()
Change DB now counted as a query
View() now goes off the default field display first
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.
Everybody Dance! PHPSimpl has reached its 0.8 release! We have been working hard the last few weeks to get PHPSimpl release worthy and the day is finally here! Included in the release are:
SetOption now accepts objects
Compressed the JS and CSS for the calendar
Change the time fields to human readable format
Fixed issue with Save() and display_order
Minor bug fixes
A more robust example
Full documentation for the classes with final API’s
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.