diff --git a/www/errorreport.php b/www/errorreport.php
index 2661dcc3c99bb37d892f359ec557b4a180125d55..4d424e68d3f6199f2a99c89273c5fb77a7fe52c0 100644
--- a/www/errorreport.php
+++ b/www/errorreport.php
@@ -95,9 +95,9 @@ if(array_key_exists('email', $_POST)) {
 
 /* Send the email. */
 $toaddress = $config->getString('technicalcontact_email', 'na@example.org');
-if($email !== 'na@example.org') {
+if ($toaddress !== 'na@example.org') {
 	
-	$email = new SimpleSAML_XHTML_EMail($email, 'simpleSAMLphp error report', $from);
+	$email = new SimpleSAML_XHTML_EMail($toaddress, 'simpleSAMLphp error report', $from);
 	$email->setBody($message);
 	$email->send();
 }