From 175eab39839bb0a72f0fb7378539a708d1e4253a Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 25 Jan 2012 09:36:09 -0500
Subject: [PATCH] Fixed: FS#1980 - Check if the mail text files contain any wrong chars in front of the From line. - Added a missing string in dns soa edit langauge file.

---
 interface/web/dns/lib/lang/en_dns_soa.lng    |    1 +
 server/plugins-available/mail_plugin.inc.php |   32 ++++++++++++++++++--------------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/interface/web/dns/lib/lang/en_dns_soa.lng b/interface/web/dns/lib/lang/en_dns_soa.lng
index 5d45f34..95afad4 100644
--- a/interface/web/dns/lib/lang/en_dns_soa.lng
+++ b/interface/web/dns/lib/lang/en_dns_soa.lng
@@ -28,4 +28,5 @@
 $wb['eg_domain_tld'] = 'e.g. domain.tld';
 $wb['eg_ns1_domain_tld'] = 'e.g. ns1.domain.tld';
 $wb['eg_webmaster_domain_tld'] = 'e.g. webmaster@domain.tld';
+$wb['The Domain can not be changed. Please ask your Administrator if you want to change the domain name.'] = 'The Domain can not be changed. Please ask your Administrator if you want to change the domain name.';
 ?>
diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index 3e3d208..4c6912f 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -160,24 +160,30 @@
 		
 		//* Send the welcome email message
 		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
-			$tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
 		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt')) {
-			$tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
 		} elseif(file_exists($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt')) {
-			$tmp = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
+			$lines = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
 		} else {
-			$tmp = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
+			$lines = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
 		}
 		
-		$welcome_mail_from  = trim(substr($tmp[0],5));
-		$welcome_mail_subject  = trim(substr($tmp[1],8));
-		unset($tmp[0]);
-		unset($tmp[1]);
-		$welcome_mail_message = trim(implode($tmp));
-		unset($tmp);
+		//* Get from address
+		$parts = explode(':',trim($lines[0]));
+		unset($parts[0]);
+		$welcome_mail_from  = implode(':',$parts);
+		unset($lines[0]);
 		
-		$welcomeFromEmail = $mail_config['admin_mail'];
-		$welcomeFromName = $mail_config['admin_name'];
+		//* Get subject
+		$parts = explode(':',trim($lines[1]));
+		unset($parts[0]);
+		$welcome_mail_subject  = implode(':',$parts);
+		unset($lines[1]);
+		
+		//* Get message
+		$welcome_mail_message = trim(implode($lines));
+		unset($tmp);
 		
 		$mailHeaders      = "MIME-Version: 1.0" . "\n";
 		$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
@@ -185,11 +191,9 @@
 		$mailHeaders     .= "From: $welcome_mail_from" . "\n";
 		$mailHeaders     .= "Reply-To: $welcome_mail_from" . "\n";
 		$mailTarget       = $data["new"]["email"];
-		// $mailSubject = "=?utf-8?Q?" . imap_8bit($welcome_mail_subject) . "?=";
 		$mailSubject      = "=?utf-8?B?".base64_encode($welcome_mail_subject)."?=";
 
 		mail($mailTarget, $mailSubject, $welcome_mail_message, $mailHeaders);
-		
 		
 	}
 	

--
Gitblit v1.9.1