# # # NOTIFY.pl # # For file/actions where this trigger is attached, send mail # to a well-known email list describing the action being taken. # # Author: A Better Solution, Inc. # email: support@abs-consulting.com # URL: http://www.abs-consulting.com # Date: Mar. 5, 2001 ############################################################ # History: Mar 5, 2001 : Created for A Better Solution, Inc. ############################################################ use strict; use Net::SMTP; ################################### ######## Site Static Data ######## ################################### ########################################### # Mail specific data that must be changed # # for your site. # ########################################### my $SUBJECT = "ClearCase Trigger Notification: $ENV{'CLEARCASE_OP_KIND'} on $ENV{'CLEARCASE_PN'}"; my @EMAIL_TO_LIST = ("john\@acme.com","jane\@acme.com"); my $SMTP_SERVER = "smtp.acme.com"; my $EMAIL_DOMAIN = "acme.com"; my $OS = "$ENV{'OS'}"; if (! $OS =~ /Windows*/ ) { ################################################################ # place path to required perl module SMTP.pm. This is located # # in a directory called Net. You will place the path to the # # parent directory that contains the Net directory. Is only # # necessary for a UNIX installation. # # You can get this module here: # # http://www.abs-consulting.com/ftp/TRIGGERS/SMTP.pm.txt # ################################################################ push(@INC, "/usr/atria/lib/perl5"); print "@INC\n"; } ################################# ######## Passed In Data ######## ################################# # NONE # ################################## ######## Calculated Data ######## ################################## my $DATE_TIME = localtime; ############################ ######## Test Data ######## ############################ # NONE # ############################# ######## PROCEDURES ######## ############################# # NONE # ######################## ######## MAIN ########---------------------------------------------------------------- ######################## ############################################# # E-mail message body text - modify at will # ############################################# my @MSG = ("Trigger activation mail notification for controlled action on VOB ($ENV{'CLEARCASE_VOB_PN'}): user: $ENV{'CLEARCASE_USER'} operation: $ENV{'CLEARCASE_OP_KIND'} date: $DATE_TIME element: $ENV{'CLEARCASE_PN'} version: $ENV{'CLEARCASE_ID_STR'} comment: $ENV{'CLEARCASE_COMMENT'}\n"); ############################################# my $smtp; $smtp = Net::SMTP->new($SMTP_SERVER); ################################################################ # Assuming that user id is a valid email prefix for the domain # # if not then adjust or hardcode (i.e. vobadm@company.com). # ################################################################ $smtp->mail($ENV{'CLEARCASE_USER'}."\@".$EMAIL_DOMAIN); $smtp->to(@EMAIL_TO_LIST); $smtp->data(); $smtp->datasend("To: @EMAIL_TO_LIST\n"); $smtp->datasend("Subject: $SUBJECT\n"); $smtp->datasend(@MSG); $smtp->dataend(); $smtp->quit;