manojsagar has asked for the wisdom of the Perl Monks concerning the following question:
Trying to send an email using my personal gmail using perl various modules (MIME::Lite, Email::Send::SMTP::Gmail, Email::Simple::Creator,Email::Sender::Transport::SMTPS), but keep getting the response 'Network Unreachable'.
Here is sample code:
!/usr/bin/perl use strict; use warnings; use Email::Sender::Simple qw(sendmail); use Email::Sender::Transport::SMTPS; use Email::Simple (); use Email::Simple::Creator (); my $smtpserver = 'smtp.gmail.com'; my $smtpport = 587; my $smtpuser = 'myuser@gmail.com'; my $smtppassword = 'myuser@gmail.com password'; my $transport = Email::Sender::Transport::SMTPS->new({ host => $smtpserver, ssl => 'starttls', port => $smtpport, sasl_username => $smtpuser, sasl_password => $smtppassword, debug => 1, }); my $email = Email::Simple->create( header => [ To => 'xxxxx@gmail.com', From => 'myuser@gmail.com', Subject => 'Hi!', ], body => "This is my message\n", ); sendmail($email, { transport => $transport });
Response:
unable to establish SMTP connection
Any help would be appreciated..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Network Unreachable issue while sending email using PERL (gmail)
by 1nickt (Canon) on Oct 12, 2017 at 17:59 UTC | |
by manojsagar (Initiate) on Oct 12, 2017 at 19:16 UTC | |
by 1nickt (Canon) on Oct 12, 2017 at 19:46 UTC | |
|
Re: Network Unreachable issue while sending email using PERL (gmail)
by sweetblood (Prior) on Oct 12, 2017 at 16:27 UTC |