FTP error checking- call e-mail sub

N

Nex_s

Hi All,

I'm doing my best to get through this one. I want to error check on
each part of the FTP process. If it fails I want to call an e-mail
sub. Unfortunately the FTP process prints an error and as such my
script fails. For some reason I also can't pass the appropriate error
message to the e-mail sub neither. Here's my code.

$errmessage = "file does not exist";
$ftp->put("temp_buffer1.txt")
or die &email($errmessage);



sub email ($errmessage) {

use Mail::Sendmail;
my %mail;
$mail{From} = 'From Me <[email protected]>';
$mail{To} = 'To Me <[email protected]>';
$server = 'smtp1.itas.net';

$mail{Smtp} = $server;
$mail{Subject} = 'Process failure!!';
$mail{Message} = $errmessage;
$mail{Message} = "It was sent on " . Mail::Sendmail::time_to_date() .
"\n";

# Go send it
sendmail %mail

}




Any help would be apprecited.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top