Quick CLI SMTP AUTH script to test authentication

I was getting a bit bored of manually testing SMTP AUTH details for people so wrote a quick little script in perl (with help of modules) to test.

#!/usr/bin/perl -w

use Net::SMTP_auth;
use Getopt::Std;

test_auth.pl   -  Check SMTP authentication

Usage:   test_auth.pl -u user -p pass -h hostname

License: This software is released under the same terms as perl itself.


die $_USAGE unless ($options{u} && $options{p} && $options{h});

$smtp = Net::SMTP_auth->new($options{h});
if ( $smtp->auth(‘CRAM-MD5’, $options{u}, $options{p}) ) {
print “Authenticated…\n”;
} else {
print “Authentication failed…\n”;