Well, you can use php code in your errorpage to send the mail automaticly when somebody sees the page. But php won't be able to determine it's a hacker or just a wrong link...
This would be an example of a 404 page:
PHP Code:
<?php
//The difference in time between you and the server. (in seconds)
$timezoneoffset = 0;
//Your emailadress
$yourmail = "you@host.com";
$requested = $_SERVER['HTTP_REFERRER'];
$ip = $_SERVER['REMOTE_ADDR'];
//Internet host name, gives some more info (isp and usually a hint of his location)
$ihn = gethostbyaddr($ip);
$time = time() + $timezoneoffset;
$date = date("Y-m-d at h:i", $time);
$mail = "<html><body>$ip ($ihn)<br>Requested the non-existing page <i>$requested</i>.<br>Time: $date<body></html>";
$headers = "From: 404 <{$_SERVER['SERVER_ADMIN']}>\r\n";
$headers .= "Content-type: text/html\r\n";
//@ makes it silent, no errors on failure
@mail($yourmail, "404 error", $mail, $headers);
?>
<html>
<head>
<title>404</title>
</head>
<body>
A HTTP 404 error has occured.
</body>
</html>