Quick perl script to test smtp auth

#!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;

 

1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. Using Google Chrome Google Chrome 19.0.1084.52 on Linux Linux

    Exelente gracias por el script un saludo!

    Comment by ly0n — June 5, 2012 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.