agnome has asked for the wisdom of the Perl Monks concerning the following question:
I'm having problems with Email::Send::Gmail. I'm using the example code on CPAN which I reproduced below and it all works fine on my local Windows machine. However, on my remote AWS server I just get the 'Email::Send::Gmail: error connecting to server smtp.gmail.com' error message and I can't seem to work out what the problem is.
#!/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 => 'myemail@gmail.com', To => 'recipient@gmail.com', Subject => 'Subject', ], body => 'Hello World!', ); my $sender = Email::Send->new( { mailer => 'Gmail', mailer_args => [ username => 'myemail@gmail.com', password => 'password', ] } ); eval { $sender->send($email) }; die "Error sending email: $@" if $@;
Looking through the code, the error message is generated by this bit of code in Email/Send/Gmail.pm:
# mostly cribbed from Email::Send::SMTP sub send { my ( $class, $message, @args ) = @_; my %args = @args; my ( $username, $password ) = @args{qw[username password]}; my $smtp = Net::SMTP::SSL->new( 'smtp.gmail.com', Port => 465, Debug => 0, ) || croak( 'Email::Send::Gmail: error connecting to server smtp.gmail.com +'); ...
Any suggestions would be most gratefully received
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with Email::Send::Gmail
by hippo (Archbishop) on Jun 17, 2015 at 22:00 UTC | |
|
Re: Problems with Email::Send::Gmail
by tonto (Friar) on Jun 17, 2015 at 22:30 UTC |