Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Using Email::Stuff to send SMTP mail through GMail

by jdtoronto (Prior)
on Sep 20, 2006 at 16:25 UTC ( [id://573932]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using Email::Stuff to send SMTP mail through GMail
in thread Using Email::Stuff to send SMTP mail through GMail

Eail::Stuff seems to be something of a wrapper around a whole lot of otehr modules, there's no problemw ith that, so after your last post I thought, well, let's see what Net::SMTP::SSL does with this:
#!/usr/bin/perl use warnings; use strict; use Net::SMTP::SSL; my $smtp = Net::SMTP::SSL->new( 'smtp.gmail.com', Port => 465, Timeout => 30, Debug => 1, ); print $@;
produces:
Net::SMTP::SSL: Bad service ''
So I think the problem is deeper again, Net::SMTP::SSL is purely a thing wrapper around Net::SMTP to enable it to use IO::SOCKET::SSL instead of IO::SOCKET::INET.

I don't have time to try more now, but this might give you some more thngs to follow up.

jdtoronto

Replies are listed 'Best First'.
Re^4: Using Email::Stuff to send SMTP mail through GMail
by initself (Monk) on Sep 20, 2006 at 19:56 UTC

    First off, testing the socket connection to smtp.gmail.com:465 works great using IO::Socket::SSL:

    use IO::Socket::SSL; my $client = IO::Socket::SSL->new("smtp.gmail.com:465"); if ($client) { print $client "GET / HTTP/1.0\r\n\r\n"; print <$client>; close $client; } else { warn "I encountered a problem: ", IO::Socket::SSL::errstr(); }

    Result:

    220 mx.gmail.com ESMTP c18sm62410hub

    Then a really simple test with Net::SMTP::SSL yields a bad result:

    use Net::SMTP::SSL; use Data::Dumper; my $smtps = Net::SMTP::SSL->new("smtp.gmail.com", Port => 465); print Dumper($smtps);

    Result:

    $VAR1 = undef;

    What puzzles me is that these are very established modules. I'll report more here when I know more.

Re^4: Using Email::Stuff to send SMTP mail through GMail
by adamk (Chaplain) on Sep 22, 2006 at 02:23 UTC
    Indeed, Email::Stuff is just a usability wrapper (I wrote it that way intentionally).

    Trouble with IO::Socket::(Anything) on Win32 would not surprise me at all, there's a few dragons there.

    What Perl distribution are you using?

    The first step might be to just write a simple test script that tries to connect via SSL, then immediately drops the connect once established, to GMail's server and see if that works.

    That would isolate the problem to the connectivity layer. If you can get that working, then lets look at Email::Stuff and friends.

    Until then though, I consider the entire Email:: family to be blameless here.

      I am on Linux, Perl 5.8.8.

      I must be missing something. I don't see how your suggestion differs from what I did at the outset. I have a simple test script that tries to connect via SSL. But I don't understand enough about the mechanism in the connectivity layer to troubleshoot what is happening in the interim between my script and their servers.

      I tried to break it down by just using Email::Send::SMTP to send a message:

      #!/usr/bin/perl use warnings; use strict; use Email::Send; my $mailer = Email::Send->new({mailer => 'SMTP'}); $mailer->mailer_args([Host => 'smtp.gmail.com:465', ssl => 1, username => 'mike@mikebaas.com', password => 'xxx']); my $message = "From: mike\@mikebaas.com To: test\@mikebaas.com Subject: testing This is the test message body."; my $result = $mailer->send($message); print "$result\n";

      The value of $result is:

      Couldn't connect to smtp.gmail.com:465

      Not quite sure how to get more detail out of the module.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://573932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-29 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found