Beside everything that has been told about http referers that can be sniffed, anonymizing proxies and so on, relying on the HTTP_REFERER is not a good programming standard.
Instead, if you have, for example:
http://www.example.com/application/client.php
Where users can click on
http://www.example.com/application/report_problem.php
Just pass the "...client.php" string to the "...report_problem.php" report problem handler you will create.
It's easy to pass the "originating" page link to the "report_problem", and can be done like this:
<?php
// pages where you will append the "problem link"
// $this_page holds an "url encoded" version of the request uri ( e.g. /application/client.php )
$this_page = rawurlencode ( $_SERVER["REQUEST_URI"] );
?>
<a href="report_problem.php?originating_page=<?=$this_page;?>">Report problem</a>
Then, in the "report_problem.php" code:
<?php
// report_problem.php
$originating_page = ( array_key_exists ( 'originating_page', $_GET ) && ! empty ( $_GET['originating_page'] ) ? rawurldecode ( $_GET['originating_page'] ) : null;
if ( ! empty ( $originating_page ) ) {
$message = 'Error report: <p>Last site visited: ' . $originating_page . '</p>....';
mail("email@email.com", "Subject", $message);
}
else mail("email@email.com", "Subject", "Problem from unkown page");
?>