#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use File::Copy;
use Mail::Sender;
use Net::SMTP;
use Email::Send::SMTP::Gmail;
my $user = '####@####.#';
my $pass = '########';
my ($mail,$error)=Email::Send::SMTP::Gmail->new( -smtp=>'smtp.gmail.co
+m',
-login=>$user,
-pass=>$pass,
-port=> '25',
-verbose=>1,
-debug=> 1,);
my $subject = "Folder Counts";
my $to = '####@####.com';
$mail->send(-to=>"$to",-from=>"$to", -subject=>"$subject");
$mail->bye;
so the above code works on my one system just fine, i and loaded all the modules that are required for this simple script, yet when i run it i get the following error.
Connecting to smtp.gmail.com using tls with LOGIN on port 25 and timeo
+ut of 60
Net::SMTPS>>> Net::SMTPS(0.06)
Net::SMTPS>>> IO::Socket::IP(0.37)
Net::SMTPS>>> IO::Socket(1.38)
Net::SMTPS>>> IO::Handle(1.36)
Net::SMTPS>>> Exporter(5.72)
Net::SMTPS>>> Net::SMTP(3.10)
Net::SMTPS>>> Net::Cmd(3.10)
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 220 smtp.gmail.com ESMTP s28sm13216
+4qts.35 - gsmtp
Net::SMTPS=GLOB(0x7ff7c22e6fe0)>>> EHLO localhost.localdomain
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-smtp.gmail.com at your service,
+ [4.14.7.58]
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-SIZE 35882577
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-8BITMIME
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-STARTTLS
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-PIPELINING
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250-CHUNKING
Net::SMTPS=GLOB(0x7ff7c22e6fe0)<<< 250 SMTPUTF8
Net::SMTPS=GLOB(0x7ff7c22e6fe0)>>> my favorite: LOGIN
Authentication (SMTP) failed
Can't locate object method "send" via package "-1" (perhaps you forgot
+ to load "-1"?)
Where is it getting "my Favorite:" from?
thanks all.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.