fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

[SOLVED] rasbian wheezy - sendemail problem

Mon Jun 06, 2016 10:46 am

Hi,

this is my actual version: uname -r: 4.1.19+ and not long time ago I've did update with command "sudo apt-get update".
Now I've a little problem with my script of sendemail.

This is a log:

Jun 06 11:56:35 raspberrypi sendemail[11395]: DEBUG => Connecting to smtp.gmail.com:25
Jun 06 11:56:35 raspberrypi sendemail[11395]: DEBUG => My IP address is: XXX.XXX.XXX.XXX
Jun 06 11:56:35 raspberrypi sendemail[11395]: SUCCESS => Received: 220 smtp.gmail.com ESMTP c191sm13374337wmh.5 - gsmtp
Jun 06 11:56:35 raspberrypi sendemail[11395]: INFO => Sending: EHLO raspberrypi
Jun 06 11:56:35 raspberrypi sendemail[11395]: SUCCESS => Received: 250-smtp.gmail.com at your service, [151.16.42.122], 250-SIZE 35882577, 250-8BITMIME, 250-STARTTLS, 250-ENHANCEDSTATUSCODES, 250-PIPELINING, 250-CHUNKING, 250 SMTPUTF8
Jun 06 11:56:35 raspberrypi sendemail[11395]: INFO => Sending: STARTTLS
Jun 06 11:56:35 raspberrypi sendemail[11395]: SUCCESS => Received: 220 2.0.0 Ready to start TLS
Jun 06 11:56:35 raspberrypi sendemail[11395]: ERROR => TLS setup failed: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version


so the error is:
ERROR => TLS setup failed: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version

I've totally no idea what is happened but I've try to use my script in another distro of linux and it's work without problem. So the problem is only in some packaged of system that I've update...

Some ideas for fix it?

Thank you
Fabio
Last edited by fabio0x0 on Tue Jul 05, 2016 7:00 am, edited 1 time in total.

RaspberryIguana
Posts: 3
Joined: Mon Jun 06, 2016 10:33 am

Re: rasbian wheezy - sendemail problem

Tue Jun 07, 2016 7:21 am

Could you please supply the part of the script that connects to the mail server?

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Tue Jun 07, 2016 7:27 am

RaspberryIguana wrote:Could you please supply the part of the script that connects to the mail server?
If you mean what command I used it's that: sendemail -f senderemail -t destinationemail -u "test" -m "ok" -s smtp.gmail.com -o tls=yes -xu username -xp password-v

but it's always worked and also if I'll use the same command in debian 8.4 I've not problem...

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Tue Jun 07, 2016 5:36 pm

I've no idea what's happened but now it's like works again! the log is changed and it say it's works!

especially I appreciate:

Jun 07 19:21:00 raspberrypi sendemail[19019]: DEBUG => TLS session initialized :)
Jun 07 19:21:00 raspberrypi sendemail[19019]: INFO => Sending: EHLO raspberrypi
Jun 07 19:21:00 raspberrypi sendemail[19019]:

:-D but has anyone done anything?

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Wed Jun 08, 2016 6:35 am

oh dear... and this morning doesn't works again... :(

Jun 08 08:33:58 raspberrypi sendemail[21590]: SUCCESS => Received: 220 2.0.0 Ready to start TLS
Jun 08 08:33:58 raspberrypi sendemail[21590]: ERROR => TLS setup failed: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version


I really don't understand what's happend....

User avatar
RaTTuS
Posts: 10506
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: rasbian wheezy - sendemail problem

Wed Jun 08, 2016 6:47 am

do you have internet access from teh PI
does a reboot clear it
are you spamming the gmail servers ?
do the logs show any other problems
are you connected via ethernet , wifi , bluetooth , wet sting ?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Wed Jun 08, 2016 6:51 am

RaTTuS wrote:do you have internet access from teh PI
does a reboot clear it
are you spamming the gmail servers ?
do the logs show any other problems
are you connected via ethernet , wifi , bluetooth , wet sting ?
- Raspberry is connected direct with router on ethernet.
- no, it's a script for send announcement to myself.

User avatar
TimG
Posts: 294
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: rasbian wheezy - sendemail problem

Sat Jun 11, 2016 12:46 pm

There used to be a bug in libio-socket-ssl-perl which caused problems with encrypted connections from sendemail. Type

Code: Select all

grep -n 'TLSv1\[12\]' /usr/share/perl5/IO/Socket/SSL.pm
and see if you have a line like this:

Code: Select all

m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i
If so you need to remove the '$'.

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Sat Jun 11, 2016 4:50 pm

TimG wrote:There used to be a bug in libio-socket-ssl-perl which caused problems with encrypted connections from sendemail. Type

Code: Select all

grep -n 'TLSv1\[12\]' /usr/share/perl5/IO/Socket/SSL.pm
and see if you have a line like this:

Code: Select all

m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i
If so you need to remove the '$'.
I've already done it... because the error is different from changing the '$' character. I think it is something from gmail....

thank you anyway

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Tue Jun 21, 2016 9:48 am

"maybe" the problem is solved with update of one or more of this packaged...
Commandline: apt-get upgrade
Upgrade: smbclient:armhf (3.6.6-6+deb7u9, 3.6.6-6+deb7u10), libxslt1.1:armhf (1.1.26-14.1, 1.1.26-14.1+deb7u1), libsmbclient:armhf (3.6.6-6+deb7u9, 3.6.6-6+deb7u10), libexpat1:armhf (2.1.0-1+deb7u3, 2.1.0-1+deb7u4), libnspr4:armhf (4.9.2-1+deb7u3, 4.9.2-1+deb7u4), libwbclient0:armhf (3.6.6-6+deb7u9, 3.6.6-6+deb7u10), samba-common:armhf (3.6.6-6+deb7u9, 3.6.6-6+deb7u10)
I'll see for next days if I've not others problems but apparently it's finally works!!!

thank you everybody to try to help me.

I'll write if after some days it's work perfectly.

Fabio

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Thu Jun 30, 2016 8:19 am

after some days the problem still persist

this is log:
Jun 30 10:14:48 raspberrypi sendemail[5485]: DEBUG => Connecting to smtp.gmail.com:25
Jun 30 10:14:48 raspberrypi sendemail[5485]: DEBUG => My IP address is: XXX.XXX.XXX.XXX
Jun 30 10:14:48 raspberrypi sendemail[5485]: SUCCESS => Received: 220 smtp.gmail.com ESMTP c142sm1235248wme.18 - gsmtp
Jun 30 10:14:48 raspberrypi sendemail[5485]: INFO => Sending: EHLO raspberrypi
Jun 30 10:14:48 raspberrypi sendemail[5485]: SUCCESS => Received: 250-smtp.gmail.com at your service, [XXX.XXX.XXX.XXX, 250-SIZE 35882577, 250-8BITMIME, 250-STARTTLS, 250-ENHANCEDSTATUSCODES, 250-PIPELINING, 250-CHUNKING, 250 SMTPUTF8
Jun 30 10:14:48 raspberrypi sendemail[5485]: INFO => Sending: STARTTLS
Jun 30 10:14:48 raspberrypi sendemail[5485]: SUCCESS => Received: 220 2.0.0 Ready to start TLS
Jun 30 10:14:48 raspberrypi sendemail[5485]: ERROR => TLS setup failed: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
so really I don't know what is a problem...if something in gmail or in raspbian (in Debian I've not problem with same command).

User avatar
TimG
Posts: 294
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: rasbian wheezy - sendemail problem

Thu Jun 30, 2016 9:51 pm

Hi Fabio,
I think connecting on port 25 is not allowed by Gmail. With TLS encryption use port 587. I assume you have already set up an app-specific password.

https://support.google.com/a/answer/176600?hl=en

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Fri Jul 01, 2016 7:09 am

TimG wrote:Hi Fabio,
I think connecting on port 25 is not allowed by Gmail. With TLS encryption use port 587. I assume you have already set up an app-specific password.

https://support.google.com/a/answer/176600?hl=en
Unfortunately, yes... thank you anyway

BigThunder
Posts: 2
Joined: Fri Jul 01, 2016 8:23 pm

Re: rasbian wheezy - sendemail problem

Fri Jul 01, 2016 8:46 pm

Hi Fabio,

I have exactly the same problem as you.
But I think I have resolved it right now.

If you look exactly on the Error Message you can see the answer: tlsv1

On a previous version of sendEmail.pm one line was written as:

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3 TLSv1')) {
Some of the user changed this line to:

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv23:!SSLv2'))
and some of the user changed it to:

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3')) {
I experimented with this line and now it works with this option:

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'TLSv1')) {
I tested it with gmail (smtp.gmail.com:587) and yahoo! mail (smtp.mail.yahoo.com:587). Both work well!
The Port 465 didn't work, Port 25 is more or less obsolet and didn' t work too.

Hope it solves your problem right now.

BigThunder

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Sun Jul 03, 2016 8:40 am

Hi,

I've got a question: where is this file sendEmail.pm ? I don't think you mean usr/share/perl5/IO/Socket/SSL.pm , do you?

Cheers
Fabio

BigThunder
Posts: 2
Joined: Fri Jul 01, 2016 8:23 pm

Re: rasbian wheezy - sendemail problem

Sun Jul 03, 2016 9:35 am

Hi,

no not the usr/share/perl5/IO/Socket/SSL.pm.

You find the sendEmail file here:
usr/bin/

Type there sudo vi sendEmail and you can change the specified line.
It should be arround line 1907.

Hope it help's you!

BigThunder

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

Re: rasbian wheezy - sendemail problem

Sun Jul 03, 2016 9:54 am

Hi,

thank you very much! Now it seems to work... I'll wait a few days before saying it's resolved.

Again thank you very much!

P.S. I have used the same fix you used

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'TLSv1')) {
Actually in Debian I've seen there is this line:

Code: Select all

if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv23:!SSLv2')) {
Is this modification necessary because something as change in gmail or in sendemail? I don't remember some update in sendemail....

In any case thank you.

Fabio

fabio0x0
Posts: 12
Joined: Mon Jun 06, 2016 10:04 am

[SOLVED] Re: rasbian wheezy - sendemail problem

Tue Jul 05, 2016 6:59 am

BigThunder wrote:Hi,

no not the usr/share/perl5/IO/Socket/SSL.pm.

You find the sendEmail file here:
usr/bin/

Type there sudo vi sendEmail and you can change the specified line.
It should be arround line 1907.

Hope it help's you!

BigThunder

After two days still working!
thank you again very much!

Fabio

in3vrr
Posts: 19
Joined: Sat Oct 08, 2016 1:30 pm

Re: [SOLVED] rasbian wheezy - sendemail problem

Sat Oct 08, 2016 2:07 pm

Using Jessie 4.4 2016-09-23 and have the same problem with SSL SendEmail
with apcupsd (UPS APC monitor).
I found usr / bin / sendmail to change the specific line with this (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'TLSv1')) {
........ but then I do not know what to do ....

On last row of /etc/apcupsd/onbattery (and other files: changeme, commfailure, commok, offbattery) I have this command:
) | $APCUPSD_MAIL -u "$MSG" -f mymail@provider.com -t $SYSADMIN -s smtp.provider.com:25
missing the password and does not work with SSL ports

I think it is also necessary to change this line....
Only this line?
How ??
Does anyone know how to fix
thank you
regards
Bob

User avatar
TimG
Posts: 294
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: [SOLVED] rasbian wheezy - sendemail problem

Mon Oct 10, 2016 3:40 pm

Hi Bob,
For me sendEmail is working without modification, using version 1.56-5 in the current Jessie package. The command-line I'm using is

Code: Select all

echo -e "this is my message" | sendEmail -f USERNAME@gmail.com -t USERNAME@gmail.com -s smtp.gmail.com:587 -o tls=yes -xu USERNAME -xp PASSWORD -q -u SUBJECT

Return to “Raspbian”