Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
want link to be sent in mail body that will open file on remote system



nagarajsh
New User

Jul 31, 2009, 2:32 PM


Views: 5413
want link to be sent in mail body that will open file on remote system

Hi,

I have script that will find the latest report file created (reports are generated everyday) and sends mail to recipients the link to that file. But the problem is the link is too long, file://systemip/folder1/folder2/folder3/abcdefghijklmnop.xls. i want to send mail with "LINK1" in place of this whole string. i tried <a href= ></a>, it did not work. please help me.

thanks in advance,

Naga


KevinR
Veteran


Jul 31, 2009, 2:38 PM


Views: 5411
Re: [nagarajsh] want link to be sent in mail body that will open file on remote system

Post the part of your code that you tried to convert the long link into a short link, and explain what "did not work" actually means.
-------------------------------------------------


nagarajsh
New User

Jul 31, 2009, 2:49 PM


Views: 5410
Re: [KevinR] want link to be sent in mail body that will open file on remote system

Hi Kevin,

here is part of my script,

use SendMail;
$smtpserver = "120.12.145.41";
$smtpport = 25;
$sender = "Naga<math\@yahoo.com>";
$recipient = "ABC<math1\@yahoo.com>";




$sm = new SendMail($smtpserver,$smtpport);
$sm->setDebug($sm->ON);
$sm->From($sender);
$sm->Subject("Reports Link");


$sm->To($recipient);

$sm->setMailBody("please click the following link to get the reports\n\n <a href=""\\\\111.1.34.100\\ABC\\Reports\\BCD\\Details\\MNO\$latest_bb_xls">click here</a>");

if ($sm->sendMail() != 0) {
print $sm->{'error'}. "\n";
exit -1;
}
print "Done\n";
exit 0;





When i run this, i get mail and the it displays "please click the following link to get the reports\n\n <a href=""\\\\111.1.34.100\\ABC\\Reports\\BCD\\Details\\MNO\$latest_bb_xls">click here</a>"

:(


KevinR
Veteran


Jul 31, 2009, 4:06 PM


Views: 5406
Re: [nagarajsh] want link to be sent in mail body that will open file on remote system

I am not familiar with the SendMail module, does it have any encoding options? If you want an email to use html widgets you would normally have to send it as html encoded.
-------------------------------------------------


FishMonger
Veteran / Moderator

Jul 31, 2009, 5:24 PM


Views: 5404
Re: [nagarajsh] want link to be sent in mail body that will open file on remote system

My choice would be to use MIME::Lite
http://search.cpan.org/~rjbs/MIME-Lite-3.024/lib/MIME/Lite.pm