HI i wrote a small simple script using Net::smtp however my local MTA is not accepting the mail here is the script :
================================================= #!/usr/bin/perl use strict; use warnings; use Net::SMTP; use Getopt::Long; my $from = '' || 'sys...@server1.com' ; my $sub = '' || 'this is a testmail'; my $content = '' || 'this is a data'; my $to; my $relayhost = '' || 'localhost'; GetOptions( 'from|f=s' => \$from , 'to|t=s' => \$to, 'sub|s=s' => \$sub , 'content|c=s' => \$content, 'relayhost|h=s' => \$relayhost ); die 'usage: sendmemail.pl--to n...@email.com' unless( $to ); my $smtp = Net::SMTP->new("$relayhost", Debug => 1, ); $smtp->mail($from); $smtp->to($to); $smtp->datasend("Subject: $sub"); $smtp->datasend("\n"); $smtp->datasend("$content\n"); $smtp->dataend(); $smtp->quit(); ==================================================================================== i am getting the following error while executing the script [r...@localhost scripts]# perl sendmemail.pl -t agnello.dso...@gmail.com Net::SMTP>>> Net::SMTP(2.31) Net::SMTP>>> Net::Cmd(2.29) Net::SMTP>>> Exporter(5.62) Net::SMTP>>> IO::Socket::INET(1.31) Net::SMTP>>> IO::Socket(1.30_01) Net::SMTP>>> IO::Handle(1.27) Net::SMTP=GLOB(0x8fc86ac)<<< 220 localhost.localdomain ESMTP Postfix Net::SMTP=GLOB(0x8fc86ac)>>> EHLO localhost.localdomain Net::SMTP=GLOB(0x8fc86ac)<<< 250-localhost.localdomain Net::SMTP=GLOB(0x8fc86ac)<<< 250-PIPELINING Net::SMTP=GLOB(0x8fc86ac)<<< 250-SIZE 10240000 Net::SMTP=GLOB(0x8fc86ac)<<< 250-VRFY Net::SMTP=GLOB(0x8fc86ac)<<< 250-ETRN Net::SMTP=GLOB(0x8fc86ac)<<< 250-ENHANCEDSTATUSCODES Net::SMTP=GLOB(0x8fc86ac)<<< 250-8BITMIME Net::SMTP=GLOB(0x8fc86ac)<<< 250 DSN Net::SMTP=GLOB(0x8fc86ac)>>> MAIL FROM:<sys...@server1.com> Net::SMTP=GLOB(0x8fc86ac)<<< 250 2.1.0 Ok Net::SMTP=GLOB(0x8fc86ac)>>> RCPT TO:<agnello.dso...@gmail.com> Net::SMTP=GLOB(0x8fc86ac)<<< 250 2.1.5 Ok Net::SMTP=GLOB(0x8fc86ac)>>> Subject: this is a testmail Net::SMTP=GLOB(0x8fc86ac)>>> this is a data Net::SMTP=GLOB(0x8fc86ac)>>> . Net::SMTP=GLOB(0x8fc86ac)<<< 221 2.7.0 Error: I can break rules, too. Goodbye. Net::SMTP=GLOB(0x8fc86ac)>>> QUIT Net::SMTP: Unexpected EOF on command channel at sendmemail.pl line 34 your help will be of much value . Thanks -- Regards Agnello D'souza