Creates a montage of event images and sends it by email.
Perl script which will send a montage of event images to a list of email addresses. uses basic scheduling to enable/disable sending of messages at predefined time blocks.
This script is typically called from the motion.conf file, it will create a montage of the images for the event given, this montage will then be sent to a list of email addresses. It will also move the event images to a backup location if required. Another feature is scheduling; for each weekday a time block can be defined, no mail will be sent within this block.
This is a work in progress... current version is 0.02
Future changes and additions:
- web interface for scheduling
- scheduling per user (so mail will be sent to users on a roster basis)
- using the imagemagick perl module instead of using a system call
motionmail.pl - main script
To install, copy this script to a location on your hard drive, for example /usr/local/bin chown and chmod, owner of the script should be the user motion runs as:
chown motion:motion /usr/local/bin/motionmail.pl
chmod 744 /usr/local/bin/motionmail.pl
after this you can run motionmail.pl -man for detailed instructions.
see 'motionmail.pl -man'
If number of recorded images for an event exceeds a certain number (e.g > 66 images), motionmail.pl stops working, because montage(image-magick) generates more than one file with the filenames montage.png.0, montage.png.1, montage.png.2, etc.
It would be nice if these images could be also attached in the mail instead the program errorbreak (montage.png: not readable)
Maibe also nice would be if these images would be included inline inside the email.
- 02 Sep 2005
I followed the steps below: To install, copy this script to a location on your hard drive, for example /usr/local/bin chown and chmod, owner of the script should be the user motion runs as:
chown motion:motion /usr/local/bin/motionmail.pl chmod 700 /usr/local/bin/motionmail.pl
after this you can run motionmail.pl -man for detailed instructions
When trying to run motionmail.pl -man I get the following error: Can't open /usr/local/bin/motionmail.pl: Permission denied at /usr/share/per/5.8/Pod/Perldoc.pm line 1380.
Any idea what I'm doing wrong?
- 09 Nov 2008
I had the same problem as above. It appears the perl man calls the script but it is no longer running as the same user and no longer had permission. Change the script prem to 744 and you should be rocking.
- 18 Nov 2009
Hi all, I haven't been here in a long time (Life tends to get busy when you start a family!) I finally am back to using Motion after using ZoneMinder
for a while. I'm currently fixing some issues with the script and I will write some better instructions on how to install and use it. Jayme: Thank you for your additions and comments in the script, it will help make this script better
I'm also thinking of doing a complete rewrite of this script to make it more flexible and easier to use. I'll see how I go with that.
this script should be owned by user root and a group that the motion user is member of (in my case its the group 'video', on other systems it may be group 'motion'). Permissions should then be 750 (full permissions for the owner, read and execute for group).
If you have trouble running 'motionmail.pl -man' you can also run the command 'perldoc /usr/local/bin/motionmail.pl'
- 20 Sep 2011
I created my own script if anybody wants to give it a try: https://github.com/7AC/pypymotion
- 11 Mar 2013
- 06 Jun 2005
- motionmail.pl.txt: My contributions (JaymeMaurice - 18 Nov 2009)...
- Sorted the file list,
- Added an important usibility addition to the MAN page (instructions for event)
- Fixed the image embeding
- Made script generate a seperate thumbnail for the attachments and leave the montage behind which is linked in as an email link
- would still like to move a bunch of things into the config file... but hope you enjoy my quick contributions.