Quick perl script to test smtp auth
Posted by vostorga - 29/12/11 at 01:12:55 pm#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtpserver = 'xxx.yyy.zzz.www';
my $smtpuser = 'foo@bar.com';
my $fromemail = 'bleh@bar.com';
my $smtp = Net::SMTP->new($smtpserver, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;
$smtp->auth ( 'user', 'secret' ) or die "Could not authenticate $!";
$smtp->mail($smtpuser);
$smtp->to('somebody@bar.com');
$smtp->data();
$smtp->datasend("To: somebody\@bar.com\n");
$smtp->datasend("From: $fromemail\n");
$smtp->datasend("\n");
$smtp->datasend("Body message\n");
$smtp->dataend();
$smtp->quit;
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.