Hi, The follow is a script I wrote designed to send mail messages with predefined attachments, as an alerts coming from Big Brother system. That is how it works: As soon as mail arrives from Big Brother, files named "down" & "up" generated by a .procmailrc file. The down & up files are trigger files that once exists, generate a mail massage with the predefined attachment (which are different for, which is specific for each server & service (there are 23 servers & 4 services). There is a directory tree of all servers & services. Each time down & up files generates in the right path respectively to the service+server damaged. I wrote this script for a single server+service. My problem now is how to make this work with multiple server+service. I want the program to go to the right path, take the right down/ up file & mail it.
How would I do it? Thanx! _______________________________________________________________________ #!/usr/bin/perl use strict; use warnings; use Net::SMTP; use MIME::Lite; # defenitions my $from_address = '[EMAIL PROTECTED]'; my $to_address = '[EMAIL PROTECTED]'; my $mail_host = 'post.tau.ac.il'; my $msg; my $subject = 'sms alert'; my $message_body = "attached message"; my $trigger_down= '/Big_Brother/attachments/faxsrv/svcs/down'; my $trigger_up= '/Big_Brother/attachments/faxsrv/svcs/up'; my $attachment_down= '/Big_Brother/attachments/faxsrv/svcs/down.asc'; my $attachment_up= '/Big_Brother/attachments/faxsrv/svcs/up.asc'; # create down mail message+ attachment (-e $trigger_down) ; $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Data => $message_body, Type =>'TEXT', ) or die "Error creating mail message: $!\n"; $msg->attach ( Path =>$attachment_down, Filename=>'down.asc', ) or die "Error adding the text message part: $!\n"; MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; unlink $trigger_down; # creating up mail message+ attachment (-e $trigger_up) ; $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Data => $message_body, Type =>'TEXT', ) or die "Error creating mail message: $!\n"; $msg->attach ( Path =>$attachment_up, Filename=>'up.asc', ) or die "Error adding the text message part: $!\n"; MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; unlink $trigger_up; _____________________________________________________ ?Ronen Kfir System Administrator T.A.U Computing Division Tel: 972-3-6407416 Fax: 972-3-6405158 cellular: 972-55-405910 E-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]