Scripts that I use on my Raspberry Pi #3

I normally use sendemail on my Rasberry Pi because it’s easiest way to send email from your Raspberry Pi Linux machine using command line.

Let’s first install sendemail:

apt-get install sendemail

Using sendemail is easy:

sendemail -xu LOGIN -xp PASSWORD -f FROM -t TO -s SERVER:PORT -o tls=yes -u "SUBJECT" -m "MESSAGE" -a ATTACHEMENT FILE

You might not need -xu, -xp or tls=yes but I have used those just to be sure.

So my typical sendemail line is pretty much like this:

sendemail -xu -xp PASSWORD -f my@email -t TO -s -o tls=yes -u "Test" -m "Just testing" -a /scripts/

When I’m not sure if my scripts/raspberry pi is working perfectly I use to add scripts as attachement so I easily have at least one
working copy of my script and different versions of it at the same time.

Now we can use this with earlier scripts example with IP scripts we can add this line to good place on that script:

sendemail -xu -xp PASSWORD -f my@email -t TO -s -o tls=yes -u "RasPi IP" -m "Your Raspberry Pi new IP address is $ip2"

If your sendemail says:

Sep 13 06:33:08 raspberrypi sendemail[16329]: ERROR => No TLS support!  SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)

It should start to work if you install libio-socket-ssl-perl:

apt-get install libio-socket-ssl-perl

This has helped every time when I have had this problem.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



This site uses Akismet to reduce spam. Learn how your comment data is processed.