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;
1 Comment »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.
Exelente gracias por el script un saludo!
Comment by ly0n — June 5, 2012 #