#################################################################### # S E N D E M A I L A F T E R R E C O R D I S A D D E D # # by JPDeni # last edited 2 May 2001 #################################################################### #################################################################### #script: default.cfg # # add new lines # # Where to put it-- # after # # Full path and file name of the html routines. # require $db_script_path . "/html.pl"; ################################################################### # Full path to sendmail on your system $mailprog = "|/usr/lib/sendmail -t"; # Your email address $admin_email = 'you@yourserver.com'; #################################################################### # To send mail to the admin after a record is added # # script: html.pl # sub html_add_success # # add new lines # # Where to put it-- # right at the beginning of the subroutine, before any other lines ################################################################### my (%rec) = &get_record($in{$db_key}); open (MAIL, "$mailprog") || &cgierr("Can't start mail program"); print MAIL "To: $admin_email\n"; print MAIL "From: $admin_email\n"; print MAIL "Subject: $html_title New Record\n\n"; print MAIL "The following new record has been added to the database:.\n\n"; foreach $col ($db_cols) { print MAIL "$col -- $rec{$col}\n"; } close (MAIL); #################################################################### # To send mail to the user after a record is added # # script: html.pl # sub html_add_success # # add new lines # # Where to put it-- # right at the beginning of the subroutine, before any other lines ################################################################### my (%rec) = &get_record($in{$db_key}); open (MAIL, "$mailprog") || &cgierr("Can't start mail program"); ######## # Be sure to change the name of the field below to match your email # field name ######## print MAIL "To: $rec{'Email'}\n"; print MAIL "From: $admin_email\n"; print MAIL "Subject: Welcome to $html_title\n\n"; ####### # Be sure to write your welcome message. You may use the $rec{'FieldName'} # variables to include values from the record if you wish. ####### print MAIL "Enter your welcome message here."; close (MAIL);