Hi,

I created a script for sending mails, but I am not able to send attachments, can any one help me on that,
I am posting that created script,


print "content-type: text/html \n\n"; #The header
print "Enter full path of the file to Send :";
$filename=<STDIN>;
$myarl="$filename";
open(myarl) or die "Cant Open File!!!";
@myar=<myarl>;
[EMAIL="$myarsize=@myar"]$myarsize=@myar[/EMAIL]; #How many rows in the file

print "\nEnter the IP Address of the Exchange Server (e.g 192.168.1.51): ";
chomp($ipadr=<STDIN>);
print "\nEnter From E-Mail Id : ";
chomp($from=<STDIN>);
print "\nEnter To E-Mail Id : ";
chomp($to=<STDIN>);
print "\nEnter the Number(e.g.100) : ";
chomp($n=<STDIN>);

for ($k=1;$k<=$n; $k++)
{
use Net::SMTP;
$smtp = Net::SMTP->new($ipadr);

$smtp->mail("$from");
$smtp->to("$to");
$smtp->data();
for ($i=0;$i<=$myarsize;$i++)
{
$data=$myar[$i];
$smtp->datasend($data);
#$smtp->datasend("\n");
}

$smtp->dataend();
$smtp->quit;

close(myarl);
}


Thanks & Regards
Srinivasa Rao. Remala

we can use "uuencode" to send attachments na

use the MIME::Lite module and sending attachments is a piece of cake.

MIME::Lite

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.