I wrote this:
#!/usr/bin/perl -w use MIME::Base64; use Net::SMTP::SSL; my($User,$Password) = ('my_email@gmail.com', 'password'); $EncodedLogin = encode_base64("\00".$User."\0".$Password); my $smtp = Net::SMTP::SSL->new('smtp.gmail.com',Port=>465,Debug=>1,Hel +lo=>'mx.google.com'); $smtp->datasend("AUTH PLAIN " . $EncodedLogin); $smtp->dataend();
With Debug set to 1, here is the output I get:
Net::SMTP::SSL>>> Net::SMTP::SSL(1.01) Net::SMTP::SSL>>> IO::Socket::SSL(1.22) Net::SMTP::SSL>>> IO::Socket::INET(1.29) Net::SMTP::SSL>>> IO::Socket(1.29) Net::SMTP::SSL>>> IO::Handle(1.25) Net::SMTP::SSL>>> Exporter(5.58) Net::SMTP::SSL>>> Net::Cmd(2.26) Net::SMTP::SSL=GLOB(0x8413678)<<< 220 mx.google.com ESMTP 32sm13404522 +wfc.50 Net::SMTP::SSL=GLOB(0x8413678)>>> EHLO mx.google.com Net::SMTP::SSL=GLOB(0x8413678)<<< 250-mx.google.com at your service, [ +xxx.xx.xx.x] Net::SMTP::SSL=GLOB(0x8413678)<<< 250-SIZE 35651584 Net::SMTP::SSL=GLOB(0x8413678)<<< 250-8BITMIME Net::SMTP::SSL=GLOB(0x8413678)<<< 250-AUTH LOGIN PLAIN Net::SMTP::SSL=GLOB(0x8413678)<<< 250 ENHANCEDSTATUSCODES Net::SMTP::SSL=GLOB(0x8413678)>>> AUTH PLAIN base_64_encoded_string_of +_my_username_and_password== Net::SMTP::SSL=GLOB(0x8413678)>>> . Net::SMTP::SSL=GLOB(0x8413678)<<< 235 2.7.0 Accepted
How can I actually use this output to check response codes etc? Example:
if($smtp->response_code==235){ print("Accepted!\n"); } else{ printf("Auth failed\n"); }
I already tried the auth() method, and it always returns 0 no matter what username/password combo I use.

In reply to Getting Net::SMTP::SSL debug information by sirsir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.