Stuff…

I know I will forget.

Stuff… header image 2

Quick CLI SMTP AUTH script to test authentication

February 9th, 2009 · No Comments

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;
%options=();
getopts(“u:p:h:”,\%options);

my $_USAGE= <<END_USAGE;
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.

END_USAGE

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”;
}

Tags: Coding · Protocols · SMTP

0 responses so far ↓

  • There are no comments yet...

Leave a Comment