Benutzer-Werkzeuge

Webseiten-Werkzeuge


mail

Dies ist eine alte Version des Dokuments!


Mail command line

Installing

sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo apt-get install mpack

Now edit the SSMTP configuration file

sudo nano /etc/ssmtp/ssmtp.conf

It needs to include this:

root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=datenlog.megheizung@gmail.com
AuthPass=Obfelden2011MEG
FromLineOverride=YES
UseSTARTTLS=YES

Save and exit

Sending an email

echo "Hello world email body" | mail -s "Test Subject" datenlog.megheizung@gmail.com

Attaching a file

mpack -s "Test" /home/pi/Trend*.csv datenlog.megheizung@gmail.com

Crontab

crontab -e
# m h  dom mon dow   command


# * * * * *  command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)

Beispiel

0 0 * * *  /home/pi/backup.sh

prepare pi directory and shell script

mkdir datenlogger
mkdir datenlogger/send

chmod 755 datenlogger datenlogger/send
shell script
sudo mv /Trend*.csv /home/pi/datenlogger/
mpack -s "HEIZUNG LOG-DATEN OBFELDEN V1.0" /home/pi/Trend*.csv datenlog.megheizung@gmail.com
mv /home/pi/datenlogger/*.csv /home/pi/datenlogger/send/
mail.1455484881.txt.gz · Zuletzt geändert: (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki