in reply to Re: Email on every page hit
in thread Email on every page hit

It will probably be an HTML page. Please advise further if possible. Thanks.

Replies are listed 'Best First'.
Re: Re: Re: Email on every page hit
by holo (Monk) on Dec 05, 2003 at 20:07 UTC

    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.