FTP error checking- call e-mail sub

Discussion in 'Perl Misc' started by Nex_s, Aug 4, 2005.

  1. Nex_s

    Nex_s Guest

    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 <>';
    $mail{To} = 'To Me <>';
    $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
     
    Nex_s, Aug 4, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    5,662
  2. Ben
    Replies:
    2
    Views:
    903
  3. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,046
    Lawrence D'Oliveiro
    May 20, 2011
  4. D. Buck
    Replies:
    2
    Views:
    494
    D. Buck
    Jun 29, 2004
  5. Nex_s

    FTP error checking- call e-mail sub

    Nex_s, Aug 4, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    105
    Dave Weaver
    Aug 8, 2005
Loading...

Share This Page