diff --git a/proxy/error.php b/proxy/error.php
index 879ae32..5f42c3b 100644
--- a/proxy/error.php
+++ b/proxy/error.php
@@ -9,9 +9,6 @@
require_once "config.php";
require_once "proxy.php";
-
-$error = "Please do not divide by zero."; //TODO: remove this and call the page properly
-$display_version = FALSE; //TODO: "
?>
@@ -120,15 +117,13 @@ $display_version = FALSE; //TODO: "

-
-
CiviProxy Version
-
+
CiviProxy Version
-
+
-
An error has occurred while processing your request
-
+ An error has occurred while processing your request:
+
diff --git a/proxy/mail.php b/proxy/mail.php
index cffd40f..0ba51a8 100644
--- a/proxy/mail.php
+++ b/proxy/mail.php
@@ -19,4 +19,8 @@ civiproxy_security_check('viewmail');
// basic restraints
$valid_parameters = array( 'id' => 'int' );
$parameters = civiproxy_get_parameters($valid_parameters);
+
+// check if id specified
+if (empty($parameters['id'])) civiproxy_http_error("Resource not found");
+
civiproxy_redirect($target_mail, $parameters);
diff --git a/proxy/proxy.php b/proxy/proxy.php
index d5b23e4..9368a84 100644
--- a/proxy/proxy.php
+++ b/proxy/proxy.php
@@ -182,7 +182,12 @@ function civiproxy_get_parameters($valid_parameters) {
*/
function civiproxy_http_error($message, $code = 404) {
global $civiproxy_version;
- header("HTTP/1.1 $code $message (CiviProxy {$civiproxy_version})");
- // TODO: create error msg body
+ global $error_message;
+
+ $civiproxy_error_message = $message;
+
+ header("HTTP/1.1 $code $civiproxy_error_message (CiviProxy {$civiproxy_version})");
+ require "error.php";
+
exit();
}