Tweets from pichat
| Follow my new user account @markseu About 2 months, 3 weeks ago from Pichat (Pichat Software) |
Tweets from 600infos
| I HAVE NYANED FOR 888.4 SECONDS! http://t.co/JQYOZebv via @nyannyancat About 3 months, 3 weeks ago from 600infos (Wolf) |
Trace: » PDF2JPG » plink tunnel » PuttyTabs » Create a random File » registry-switcher.cmd » sendEmail
You are here: Pichat Wiki (en) » Snippets » sendEmail
sendEmail
Example
sendEmail -v -f username@web.de -s smtp.web.de:25 -xu username -xp totalgeheim -t adminempfaenger@gmx.de -o tls=yes -u “Betreff: Test!” -m “Hallo, dies ist ein Test!”
Optionen
-v verbose: geschwätziger Modus (hilfreich zur Fehlersuche) -f from: die Absenderadresse, von der die mail versandt werden soll (hier: username@web.de) -s server&port: Der zuständige SMTP-Server samt Portangabe -xu username: Der Benutzername. (Manche Provider erwarten hier die komplette Emailadresse) -xp password (SMTP): bei web.de das reguläre Benutzerpasswort -t to: Empfängeradresse -cc Kopie der Mail senden an: 2. Emailadresse -bcc Versteckte Kopie der Mail senden an: 2. Emailadresse -o hier: tls=yes – sorgt für eine verschlüsselte TLS-Übertragung -u subject: Betreffzeile -m message: Inhalt der Email -a attachment: Pfad zu Dateianhang, der mitgesendet werden soll
Install
sudo apt-get install sendEmail libio-socket-ssl-perl libnet-ssleay-perl perl
wget --output-document=sendamail.sh http://pichat-wiki.de/_export/code/snippets/sendemail?codeblock=1 chmod 700 sendamail.sh
Script
- sendamail.sh
#!/bin/sh # sendamail.sh _deb=debugfile _server=smtp.server.org _user=username@mydomain.org _pw=password _attachment=attach.txt _to=admin@home.net _from=noreply@server.dom _subject="$HOSTNAME Mail from Script $0 `date`" _msg="some tails of logfiles ... see attachment" echo `date` ===== extract of log files ===== > $_attachment uname -a >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment echo tail -n 100 $_deb >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment tail -n 100 $_deb >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment echo tail -n 100 /var/log/messages >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment tail -n 100 /var/log/messages >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment echo tail -n 100 /var/log/auth.log >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment tail -n 100 /var/log/auth.log >> $_attachment echo ------------------------------------------------------------------------------------ >> $_attachment sendEmail -v -f $_from -s $_server -xu $__user -xp $_pw -t $_to -o tls=yes -u $_subject -m $_msg -a $_attachment >> $_deb 2>&1 exit 0