haprst has asked for the wisdom of the Perl Monks concerning the following question:

In the past I could send emails using sendEmail.pl. I recently was forced to upgrade to Windows 10, and I changed to Strawberry instead of ActivePerl. Meanwhile I think Gmail disabled SSL. The result is I can't get email working. My latest attempt was this for a start:

use strict; use warnings; use Email::Send::SMTP::Gmail; my ($mail,$error)=Email::Send::SMTP::Gmail->new ( -smtp=>'smtp.gmail.com', -login=>'MYGMAILNAME@gmail.com', -pass=>'MYPASSWORD', -port=>587, -layer=> 'tls', -verbose=>1, -debug=>1 );

The result is 19 good messages followed by 2 bad messages. Starting at message 18, here's what I see:

Net::SMTPS=GLOB(0x2c8b140>>>> STARTTLS Net::SMTPS=GLOB(0x2c8b140>>>> 220 2.0.0 Ready to start TLS DEBUG: .../IO/Socket/SSL.pm:525 global error: SSL Version SSLv2 not su +pported Could not connect to SMTP server

Why is it still referring to SSL and how did port 525 get there? Please give me a simple solution, as I'm 75 years old and running out of time. Thanks.

Replies are listed 'Best First'.
Re: Problem sending Gmail from Widows 10
by Corion (Patriarch) on Nov 09, 2015 at 18:17 UTC
    global error: SSL Version SSLv2 not supported

    Most likely, your version of IO::Socket::SSL does not support SSLv2. This should be OK according to IO::Socket::SSL because SSLv2 and SSLv3 have serious security issues and should not be used anymore.

    Maybe you can pass the appropriate SSL_version configuration to Email::Send::SMTP::Gmail or set it somewhere where IO::Socket::SSL can pick it up? I'm not really sure why Google would only want to talk SSLv2 with you(r program), so maybe you can investigate why such an insecure encryption layer would be used...

      Unfortunately, the advice of all three people didn't help. Curiously, if I change the case from -layer=> 'tls', to -layer=> 'TLS', then the error messages change entirely:

      ... Net::SMTPS=GLOB(...etc...)>>>> EHLO localhost.localdomain Net::SMTPS=GLOB(...etc...)>>>> 250-smtp.gmail.com at your service .. +. Net::SMTPS=GLOB(...etc...)>>>> 250-SIZE 35882577 Net::SMTPS=GLOB(...etc...)>>>> 250-8BITMIME Net::SMTPS=GLOB(...etc...)>>>> 250-STARTTLS Net::SMTPS=GLOB(...etc...)>>>> 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(...etc...)>>>> 250-PIPELINING Net::SMTPS=GLOB(...etc...)>>>> 250-CHUNKING Net::SMTPS=GLOB(...etc...)>>>> 250 SMTPUTF8 Net::SMTPS=GLOB(...etc...)>>>> AUTH LOGIN Net::SMTPS=GLOB(...etc...)>>>> 530 5.7.0 Must issue a STARTTLS comma +nd first ... Authentication (SMTP) failed

      but note that one of the messages confirmed STARTTLS already.

        Net::SMTPS=GLOB(...etc...)>>>> EHLO localhost.localdomain Net::SMTPS=GLOB(...etc...)>>>> 250-smtp.gmail.com at your service .. +. Net::SMTPS=GLOB(...etc...)>>>> 250-SIZE 35882577 Net::SMTPS=GLOB(...etc...)>>>> 250-8BITMIME Net::SMTPS=GLOB(...etc...)>>>> 250-STARTTLS Net::SMTPS=GLOB(...etc...)>>>> 250-ENHANCEDSTATUSCODES Net::SMTPS=GLOB(...etc...)>>>> 250-PIPELINING Net::SMTPS=GLOB(...etc...)>>>> 250-CHUNKING Net::SMTPS=GLOB(...etc...)>>>> 250 SMTPUTF8 Net::SMTPS=GLOB(...etc...)>>>> AUTH LOGIN Net::SMTPS=GLOB(...etc...)>>>> 530 5.7.0 Must issue a STARTTLS comma +nd first ... Authentication (SMTP) failed

        but note that one of the messages confirmed STARTTLS already.

        Are you sure? I only see an SMTP server identifying as smtp.gmail.com announcing its capabilities conforming to RFC1869, which are 8 bit MIME messages, TLS encrypted communication, enhanced status codes, and so on. I don't see any TLS confirmation here. RFC2487 documents that the EHLO command needs to be followed by a STARTTLS command. Your output shows AUTH LOGIN instead.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Problem sending Gmail from Widows 10
by james28909 (Deacon) on Nov 10, 2015 at 01:11 UTC
    Im sure you already know this, but i will say it anyway... in gmail, there are settings that you need to enable for stuff like this. If a 3rd party program will be connecting to gmail to send emails, you will definitely need to turn these settings on in gmail settings.
Re: Problem sending Gmail from Widows 10
by Anonymous Monk on Nov 14, 2015 at 21:10 UTC

    Regarding the messages.

    DEBUG: .../IO/Socket/SSL.pm:525 refers to the 525th line of the installed SSL.pm module, as the place of message origin.

    250-STARTTLS in the EHLO response indicates the availability (server willingness). Line with 530 is the actual error.

    Email::Send::SMTP::Gmail has Net::SSLeay among its dependencies. Net::SSLeay provides the actual glue to openssl library.

    See if you can increase the debugging level by including

    $Net::SSLeay::trace = 2;
    in your program. The detailed handshake may bring you closer to the cause of the failure.

Re: Problem sending Gmail from Widows 10
by aquacade (Scribe) on Nov 12, 2015 at 22:10 UTC

    I don't think Gmail settings can entirely solve your problem even as of today.

    See brutish workaround at the bottom of this link that might help with SSL issue on some servers (or might not) but worth a try perhaps:

    http://community.activestate.com/node/10130

    One other devil in the Gmail details is what Google calls "adaptive spam filtering" which we faced. When SMTPing blast of emails using Gmail SMTP directly, that caused a varying number of emails to send properly, but the remainder of our maillist got clipped/truncated because of this Gmail feature.

    We eventually had to set up our own SMTP server to avoid sending through Gmail's SMTP, but we included our real Gmail address as the Reply-To header so any responses came back where we wanted them!

    Hope this helps or inspires other ideas!

    Larry

    ..:::::: aquacade ::::::..