User Tools

Site Tools


setupmotionmail

If you configured your motion configuration file successfully, then you can add the funcionality to send an email in the case that a motion was detected.

Install mail

I am not shure if you have to install the “mail” program.

Configure sSMTP

You have to change the file, like in this excample for Gmail

sudo nano /etc/ssmtp/ssmtp.conf
 
root=[YourMail]
mailhub=mail
hostname=[Name]
AuthUser=[YourUserName]
AuthPass=[YourPassword]
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

Configure motion

You will find the default configuration file in /etc/motion/motion.conf In the section “External Commands…” you can setup a lot of things you will do.

If you just want an info mail when a motion was detected, use this:

# Command to be executed when an event starts. (default: none)
# An event starts at first motion detected after a period of no motion defined by gap
on_event_start echo "Motion detected on cam_%t at %Y-%m-%d %H:%M:%S" | mail -s "Motion detected on cam_%t" yourmail@domain.com

This will send me an E-Mail with the Subject “Motion detected on cam_1”.

If you want to get an info mail for each time a picture was saved or motion frame detected, use this

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)
# To give the filename as an argument to a command append it with %f
;on_picture_save echo "Motion detected on cam_%t at %Y-%m-%d %H:%M:%S" | mail -a %f -s "Motion detected on cam_%t" yourmail@domain.com
 
# Command to be executed when a motion frame is detected (default: none)
;on_motion_detected echo "Motion detected on cam_%t at %Y-%m-%d %H:%M:%S" | mail -s "Motion detected on cam_%t" yourmail@domain.com

This also added the picture to the E-Mail, but you will receive for each picture a mail.

setupmotionmail.txt · Last modified: 21.04.2014 22:46 by tigermatze