7

I want to send a email. Here my working example on ubuntu:

sendEmail -f <FROM_EMAIL> -t <TO_EMAIL> -u 'Book' -m 'ISBN: 12345-678-90' -s smtp.gmail.com -o message-charset=utf8 -o tls=yes -xu <USERNAME> -xp <PASSWORD>

On the raspberry i get an error:

invalid SSL_version specified at /usr/local/share/perl/5.14.2/IO/Socket/SSL.pm line 332

I have no idea, what ist wrong. Has anyone an idea, how to solve the problem? Alternarive - an replacement for the sendEmail without own smtp server?

Alex Chamberlain
  • 15,638
  • 15
  • 69
  • 113
cupakob
  • 1,057
  • 3
  • 13
  • 17

5 Answers5

7

The bug appears to be in line 1490 of /usr/local/share/perl/5.14.2/IO/Socket/SSL.pm.

The SSL_version is being coded as "SSLv3 TLSv1" and the regular expression is failing.

I hacked it as a workaround as follows...

change:

    m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i 

to:

    m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))}i 

That did the trick for me.

Tom Agnew
  • 71
  • 1
4

...it seems to be a bug in Debian:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679911

and here replacement for sendEmail:

http://www.logix.cz/michal/devel/smtp-cli

Now i can send email with this command:

smtp-cli --verbose --host smtp.gmail.com --user <USER> --auth-plain --from <FROM_EMAIL> --to <TO_EMAIL> --pass <PASSWORD> --subject "Test" --body-plain "Log files are attached."

smtp-cli --verbose --host smtp.gmail.com --user abcde --auth-plain --from abcde@gmail.com --to fggga@gmail.com --pass topSecret --subject "Test" --body-plain "Log files are attached."
cupakob
  • 1,057
  • 3
  • 13
  • 17
4

After installing sendemail on Raspberry pi, there will be an error

"No TLS support!".

To fix it, install tls packages:

sudo apt-get install libnet-ssleay-perl libio-socket-ssl-perl

or

sudo apt-get install libio-socket-ssl-perl libnet-ssleay-perl

Then after running "sendemail", we will get the error

"invalid SSL_version specified at /usr/local/share/perl/5.14.2/IO/Socket/SSL.pm line 332"

Method below works:

sudo nano usr/share/perl5/IO/Socket/SSL.pm

then change

  • m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i

to:

  • m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))}i
Marius Butuc
  • 925
  • 3
  • 11
  • 20
Homeway
  • 41
  • 2
0

Another reason for SSL failure is the time used for time stamping the communications. Make sure that the system time on the Pi is current.

Either run ntpd or run sudo ntpdate <some time server>. ntpd corrects the system time in small increments. if your time is off by hours, it will take days to fix it.

Lord Loh.
  • 657
  • 11
  • 26
0

Thanks a lot Tom & Marius !

I've found that you have to travel to,

sudo nano usr/share/perl5/IO/Socket/SSL.pm

and replace this:

m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i

with this:

m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))}i

This solves it. :-)

Kachamenus
  • 749
  • 6
  • 26
ppr
  • 1