From 56a9c765e6409900ed3b9225be839bf6200260ae Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 29 Jun 2016 13:50:19 +0200
Subject: [PATCH] Replace Windows line breaks with Unix line breaks in custom
 mail filters.

---
 server/plugins-available/maildeliver_plugin.inc.php | 2 +-
 server/plugins-available/maildrop_plugin.inc.php    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 35001a4cde..2c16601f50 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -132,7 +132,7 @@ class maildeliver_plugin {
 
 			// Custom filters
 			if($data["new"]["custom_mailfilter"] == 'NULL') $data["new"]["custom_mailfilter"] = '';
-			$tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]);
+			$tpl->setVar('custom_mailfilter', str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]));
 
 			// Move junk
 			$tpl->setVar('move_junk', $data["new"]["move_junk"]);
diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 1ebb677e42..2fefa26cfc 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -211,7 +211,7 @@ class maildrop_plugin {
 						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
 					}
 				}
-				$mailfilter_content .= $data["new"]["custom_mailfilter"];
+				$mailfilter_content .= str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]);
 
 				// Replace windows linebreaks in mailfilter file
 				$mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content);
-- 
GitLab