diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php
index 4c6d8235c7b96308d5b91d1b18ea3b32b9bc2131..45c32179f63ff79b9c491994cd9b355d5fecfe07 100644
--- a/interface/lib/plugins/mail_user_filter_plugin.inc.php
+++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php
@@ -137,8 +137,14 @@ class mail_user_filter_plugin {
 			$content = '';
 			$content .= '### BEGIN FILTER_ID:'.$page_form->id."\n";
 
-			//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
-			
+			if($page_form->dataRecord["source"] == 'Header') {
+				$parts = explode(':',trim($page_form->dataRecord["searchterm"]));
+				$page_form->dataRecord["source"] = trim($parts[0]);
+				unset($parts[0]);
+				$page_form->dataRecord["searchterm"] = trim(implode(':',$parts));
+				unset($parts);
+			}
+
 			if($page_form->dataRecord["op"] == 'domain') {
 				$content .= 'if address :domain :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n";
 			} elseif ($page_form->dataRecord["op"] == 'localpart') {
@@ -152,15 +158,7 @@ class mail_user_filter_plugin {
 				$content .= 'if size :over '.intval($page_form->dataRecord["searchterm"]).$unit.' {'."\n";
 			} else {
 			
-				if($page_form->dataRecord["source"] == 'Header') {
-					$parts = explode(':',trim($page_form->dataRecord["searchterm"]));
-					$page_form->dataRecord["source"] = trim($parts[0]);
-					unset($parts[0]);
-					$page_form->dataRecord["searchterm"] = trim(implode(':',$parts));
-					unset($parts);
-				}
-
-				$content .= 'if header :regex    ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
+				$content .= 'if header :regex    "'.strtolower($page_form->dataRecord["source"]).'" ["';
 
 				# special chars in sieve regex must be escaped with double-backslash
 				if($page_form->dataRecord["op"] == 'regex') {