for plain html files, you just need to install a PerlFixupHandler for the files you need to trigger.
<Files ~ "\.html$">
PerlFixupHandler MyPackage::MailMe;
</Files>
Create a package somewhere in @INC that says.
package MyPackage::MailMe;
use Apache::RequestIO;
use Apache::RequestRec;
use Apache::Const -compile => 'OK';
use Mail::Sendmail;
sub handler {
my $r = shift;
sendMail($r->uri);
Apache::OK;
}
sub sendMail {
my $page_visited = shift;
my %mail = (
To => 'jones@company.com',
From => 'smith@company.com',
Subject => "Page visited",
Message => "$page_visited was visited",
);
$mail{smtp} = '111.22.333.444';
sendmail(%mail) || die "\nProblem! $Mail::Sendmail::error\n";
}
This is untested and incomplete. Read the modperl docs to find out more. |