diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 0d2298afe78e932e58d9e9a3dd0ed0675ddedf03..aafa280bddfa7253b90be31f20d6e222f1b39c30 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -421,6 +421,15 @@ class SimpleSAML_Utilities {
 			$t->data['errorreportaddress'] = NULL;
 		}
 
+		$session = SimpleSAML_Session::getInstance();
+		$attributes = $session->getAttributes();
+		if(is_array($attributes) && array_key_exists('mail', $attributes) && count($attributes['mail']) > 0) {
+			$email = $attributes['mail'][0];
+		} else {
+			$email = '';
+		}
+		$t->data['email'] = $email;
+
 		$t->data['exceptionmsg'] = $emsg;
 		$t->data['exceptiontrace'] = $etrace;
 		
diff --git a/templates/default/error.php b/templates/default/error.php
index 83ad3cc3f43d434e2c2b2c1ff6b03ba2b4606d09..fcc1b1a54b7dfd12c3c13b7f51e774692ffe0d0c 100644
--- a/templates/default/error.php
+++ b/templates/default/error.php
@@ -57,7 +57,7 @@ if (!empty($this->data['errorreportaddress'])) {
 	<form action="<?php echo htmlspecialchars($this->data['errorreportaddress']); ?>" method="post">
 	
 		<p><?php echo $this->t('report_text'); ?></p>
-			<p><?php echo $this->t('report_email'); ?> <input type="text" size="25" name="email" value="" />
+			<p><?php echo $this->t('report_email'); ?> <input type="text" size="25" name="email" value="<?php echo($this->data['email']); ?>" />
 	
 		<p>
 		<textarea style="width: 300px; height: 100px" name="text"><?php echo $this->t('report_explain'); ?></textarea>