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?

2
  • What distro are you using and is it up to date?
    – Jivings
    Oct 7, 2012 at 13:07
  • I'm using the raspbian wheezy and yes - it is up to date.
    – cupakob
    Oct 7, 2012 at 13:14

5 Answers 5

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.

2
  • nice, i must try it :)
    – cupakob
    Nov 12, 2012 at 20:26
  • works, but i've used the /usr/share/perl5/IO/Socket/SSL.pm. Thanks a lot...
    – cupakob
    Nov 13, 2012 at 16:39
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 [email protected] --to [email protected] --pass topSecret --subject "Test" --body-plain "Log files are attached."
1
  • This worked like a charm. I should note that I had this problem on an x64 ubuntu 15.04, so it looks like nobody is going to fix the Perl bug ...
    – mhvelplund
    Aug 14, 2015 at 13:20
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
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.

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. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.