USAGE:- ./perlscript
#!/usr/bin/perl
use Net::SMTP;
$filename = $ARGV[0];
$smtpserver = $ARGV[1];
open (FH, "<$filename") || die "Could not open email file $!\n";
(@lines) =
close(FH);
#open(EFILE2,"<$text_attach") || die "Could not open email file $!\n";
#(@lines) =
#close(EFILE2);
#close(FH);
#my $ServerName = $smtpserver;
#$smtp = Net::SMTP->new($ServerName, Debug => 0);
#$smtp = Net::SMTP->new("xx.xx.xx");
$smtp = Net::SMTP->new($smtpserver,
Hello => 'mail.testmail.co.in',
Port => 25,
Timeout => 30,
Debug => 1,
);
$from="test\@rediffmail.com";
$cc_list="test\@yahoo.com";
#$recip2="f\@lehman.com";
$recip2="test\@anilkumar.com";
$smtp->mail("$from");
###############################################
##$smtp->to("$recip,$cc_list");
##$smtp->cc("$cc_list");
##$smtp->bcc("$bcc");
###############################################
$smtp->recipient($recip2,$cc_list);
$smtp->data;
$smtp->datasend("To: $recip2\n");
$smtp->datasend("From: $from\n");
$smtp->datasend("Cc: $cc_list\n");
$smtp->datasend("Bcc: $bcc\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("MIME-Version: 1.0 \n");
$smtp->datasend("Content-Type: text/html; charset=us-ascii \n");
$smtp->datasend("\n");
$smtp->datasend(@lines);
$smtp->dataend();
$smtp->quit;