From 4569cae57f127afd093794310ccd290d2d9fdf36 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Wed, 20 Apr 2016 10:58:46 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 server/plugins-available/mail_plugin.inc.php |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index caec01a..8696205 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -206,7 +206,17 @@
 		}
 
 		//* Send the welcome email message
-		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
+		$domain = explode('@', $data["new"]["email"])[1];
+		$html = false;
+		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html')) {
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html');
+			$html = true;
+		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html')) {
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html');
+			$html = true;
+		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
+			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt');
+		} elseif(file_exists($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')) {
 			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
@@ -233,8 +243,13 @@
 		unset($tmp);
 
 		$mailHeaders      = "MIME-Version: 1.0" . "\n";
-		$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
-		$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+		if($html) {
+			$mailHeaders     .= "Content-Type: text/html; charset=utf-8" . "\n";
+			$mailHeaders     .= "Content-Transfer-Encoding: quoted-printable" . "\n";
+		} else {
+			$mailHeaders     .= "Content-Type: text/plain; charset=utf-8" . "\n";
+			$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+		}
 		$mailHeaders     .= "From: $welcome_mail_from" . "\n";
 		$mailHeaders     .= "Reply-To: $welcome_mail_from" . "\n";
 		$mailTarget       = $data["new"]["email"];

--
Gitblit v1.9.1