Motion Event Mailer in PHP
Simple Php which compresses and mails event pictures at the end of an event
Tired of logging onto your website to see what happened the last time an event took place, but you would like to know straight away? This script is for you...
What does it do?
This simple CLI php script creates a tarball of the pictures taken during the last event, compresses them and mails them to the address you specify. Most people could write something this simple themselves, but this may save them a few minutes.
I intend adding a few more features in the future, as well as a simple install script so that this doesn't need to be modified itself.
The majority of this code is thanks to the php mailer class http://phpmailer.sourceforge.net/
and all the developers who contributed to this project. I am but a humble modifier of their genius.
This does not mean that support queries should be directed to them as they have nothing to do with this specific project.
Zip file containing the following:
You need to install PHP with command line interface and the PHP mailer class
Installing PHP with CLI
Please see: http://www.phpbuilder.com/manual/
for instructions to install this.
Installing PHP mailer class
Please see http://phpmailer.sourceforge.net/
(this is included in the zip file)
How do you install the program? (assume talking to a newbie)
- Copy the php mailer files into your php classes directory (for inclusion) (This is the path specified in your php.ini file under include_path)
- Copy the zipper.php to a location of your choice (which can be reached by the user you are running motion with)
- Edit zipper.php and change the sender address, recipient address and smtp server to ones of your choice (Please take close note of comments in the file and edit accordingly)
- Modify the on_event_end option in your motion.conf or relevant thread file to to reflect the following:
on_event_end php /location/to/zipper.php "%v-%Y%m%d"
(Please note that the conversion specifier must be the same as that of the beginning of the file names being saved)
No further requirements
I will be clearing up the installation instructions shortly as well as making the variables more clear inside of the MotionEventMailer
script. Please be patient and mail me should you require clarification.
I have given you a helping hand with the formatting.
The attached files contains software (PHP mailer and PHP SMTP class) which is under the LGPL license. Note that you need to include the LGPL license as it is described in the headers of the two files. Otherwise you (and I) violate the license. Just include the LICENSE file in your next ZIP and you are OK. It is as simple as that.
- 10 Jan 2006
Thanks for the help and pointers Kenneth.
I have tried to update the previous files with no luck, but have uploaded a new one with license included.
Please feel free to remove the previous ones as I seem unable to do this.
Thanks once again.
- 14 Jan 2006