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.