PERL Email :: Send :: Gmail Cannot Connect to a Gmail Account in Windows 7

I try to use Email::Send::Gmailto send email, but for some reason I get an error that it does not allow me to connect.

The code is a standard example:

#!/usr/bin/perl
use strict;
use warnings;
use Email::Send;
use Email::Send::Gmail;
use Email::Simple::Creator;

my $email = Email::Simple->create(
header => [
    From    => 'myaddress@gmail.com',
    To      => 'myaddress@gmail.com',
    Subject => 'Server down',
],
body => 'The server is down. Start panicing.',
);

my $sender = Email::Send->new(
{   mailer      => 'Gmail',
    mailer_args => [
        username => 'myaddress@gmail.com',
        password => 'XXXX',
    ]
}
);
eval { $sender->send($email) };
die "Error sending email: $@" if $@;

Exact error:

Email::Send::Gmail: error connecting to server smtp.gmail.com 
at C:/Perl/site/lib/Email/Send.pm line 256.

I looked through my gmail account and there seems to be nothing to "allow access". I work in Windows7 and run from the command line.

Any ideas?

Thanks, A

+4
source share
2 answers

Time to update your dependencies.

Email::Gmail::Send Net::SMTP::SSL, IO::Socket::SSL. , , , .

, 4 , , IO::Socket::SSL 1.986 Strawberry Perl 5.18.2.

t/public_suffix_lib_uri.t ......... ok
failed to connect: An operation was attempted on something that is not a socket. at t/public_suffix_ssl.t line 87.
# Looks like you planned 24 tests but ran 2.
# Looks like your test exited with 10038 just after 2.

, IO::Socket::SSL 1.988, Windows 7, Linux. (cpan ticket 95881), Gmail Windows.

. application specific password , Gmail " ".

+4

Perl.

:

  • Email:: : Gmail
  • Net:: SMTP: SSL
  • installIO:: Socket:: SSL

.

 #!/home/ben/software/install/bin/perl
        use warnings;
        use strict;
        use Email::Send;
    use Email::Send::Gmail;
    use Email::Simple::Creator;

    my $email = Email::Simple->create (
        header => [
            From    => '@gmail.com',
                To      => '@gmail.com',
                Subject => 'Make it simple',
        ],

        body => 'buddy I got it ...',
    );

    my $sender = Email::Send->new 
    ({
            mailer      => 'Gmail',
            mailer_args => 
[
                username => '',
                password => '',
        ]
    });

    $sender->send ($email);
0

Source: https://habr.com/ru/post/1540900/


All Articles