/ PHP

Send Email – Authentication Error using Net::SMTP::SSL

I have been creating a simple monitoring tool for my server at home using Perl and during that process I have come up with an error occured while I was trying to send email using Secure SMTP via Google Mail although all the account information was correct and the code appeared to be OK:

if (not $smtp = Net::SMTP::SSL->new('smtp.gmail.com', 
                Port => 465, Debug => 1))   
                        die "Server Connection Error";

$smtp->auth(" [account login] ", " [ account password ] ")
       || die "Authentication Error";

The issue was related to a missing component: SASL.

Apt-getting it resolves the issue - no clear description and reason in the debug output for the failure, but that is the solution.

sudo apt-get install libauthen-sasl-perl
Koray Alkan

Koray Alkan

Software Developer @Bloomberg. Love classical music, reading and playing the trumpet. Opinions are my own.

Read More