PERL Email::Send::Gmail Cannot connect to Gmail account on Windows 7

前端 未结 2 1330
走了就别回头了
走了就别回头了 2021-01-06 07:25

I am trying to use Email::Send::Gmail to send an email, but for some reason I am getting an error that it is not allowing me to connect.

The code is the standard exa

相关标签:
2条回答
  • 2021-01-06 07:30

    Time to upgrade your dependencies.

    Email::Gmail::Send depends on Net::SMTP::SSL which depends on IO::Socket::SSL. The first step I take to solving this type of problem is to upgrade the module dependencies just in case a new issue has already been addressed.

    Unfortunately, 4 Days ago when you first introduced this problem, I was unable to pass the test suite for IO::Socket::SSL 1.986 on 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.
    

    Fortunately, since then the author has updated the module to IO::Socket::SSL 1.988, and I'm able to fully install and use it on both Windows 7 and Linux. Currently it throws redefined warnings (cpan ticket 95881), but I was able to send Gmail messages on Windows after upgrading this dependency.

    Note: You'll want to create an application specific password for this code, otherwise Gmail might block the login and send you a "Suspicious sign in prevented" email.

    0 讨论(0)
  • 2021-01-06 07:44

    Just Upgrade your active Perl version.

    Then Install following modules: ppm

    1. install Email::send:Gmail
    2. install Net::SMTP:SSL
    3. installIO::socket::SSL

    Then try with below sample code.

     #!/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 讨论(0)
提交回复
热议问题