From b31bb1f27f066a2d49f5ab9ee0ca15e985efc788 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 26 Sep 2011 06:50:23 -0400
Subject: [PATCH] Fixed: FS#1619 - Add apache SNI / SAN support for SSL.

---
 server/plugins-available/mail_plugin.inc.php |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index a69c4c0..6781fb6 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -157,6 +157,40 @@
 				$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
 			}
 		}
+		
+		//* 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');
+		} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt')) {
+			$tmp = 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');
+		} else {
+			$tmp = 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);
+		
+		$welcomeFromEmail = $mail_config['admin_mail'];
+		$welcomeFromName = $mail_config['admin_name'];
+		
+		$mailHeaders      = "MIME-Version: 1.0" . "\n";
+		$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"];
+		// $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);
+		
+		
 	}
 	
 	function user_update($event_name,$data) {

--
Gitblit v1.9.1