Forum des Objets Communicants et Solutions pour les Libérer...
|
| | karotz photo to email | |
| | Auteur | Message |
---|
carlo64 Bronze Nabz
Localisation : italia Nbr de messages : 162 Carottes : 3586
| Sujet: karotz photo to email Dim 15 Mar 2015 - 10:56 | |
| Hi I modified a script to send via email a Karotz photo could be included in the usual crontab to send itself every few time you photos of the house in the office ... code here /usr/www/cgi-bin/snapshot_email please change with your dates account - Code:
-
#!/bin/bash
source /www/cgi-bin/setup.inc source /www/cgi-bin/url.inc source /www/cgi-bin/utils.inc source /www/cgi-bin/leds.inc source /www/cgi-bin/ears.inc source /www/cgi-bin/webcam.inc
KillProcess
ReadUrlParam TDIR="/www/snapshots/"
# insert you dates SMTP=smtp.gmail.com:587 USER=nameaccount@gmail.com PWD=passwordaccount FROM=nameaccount@gmail.com TO=nameaccount@gmail.com FILEMAIL=/tmp/m FN="snapshot"_`date +'%Y_%m_%d_%H_%M_%S'`
TakeSnapshot
if [ ! -e "$CNF_DATADIR/Run/karotz.sleep" ]; then LedsRestore if [ "$SILENT" == "" ]; then PlaySound /usr/karotz/res/sounds/webcam.mp3 fi fi if [ ! -e "/tmp/picture.jpg" ]; then Log "Snapshot" "Unable to take snapshot" 1 DATA='{"return":"1","msg":"Unable to take snapshot."}' SendResponse "$DATA" exit 0 fi
# # create msg # echo "subject: foto $FN">$FILEMAIL makemime /tmp/picture.jpg >>$FILEMAIL # # sendmail # sendmail -H "exec openssl s_client -quiet -connect $SMTP -tls1 -starttls smtp" -f $FROM -au$USER -ap$PWD $TO 2> /tmp/sendmailerror <$FILEMAIL # # test error code # if [ $? -eq 0 ]; then DATA='{"filename":"'$FN'.jpg","return":"0"}' else ERR=`cat /tmp/sendmailerror` DATA='{"message":"'$ERR'","return":"0"}' Log "Snapshot" "Unable to send mail" 1 fi
SendResponse "$DATA"
I used the gmail account and it was necessary to lower its level of security ( https://www.google.com/settings/security/lesssecureapps ) Carlo | |
| | | | karotz photo to email | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |
|