Daniel Steglich
2016-02-05 be2cd7358fc41a4260b6f707ac1d0efec1a85b18
Allow HTML based welcome messages

In addition to /conf-custom/mail/welcome_email_DOMAINNAME.txt and /conf-custom/mail/welcome_email_LANGUAGE.txt one may place a /conf-custom/mail/welcome_email_DOMAINNAME.html or /conf-custom/mail/welcome_email_LANGUAGE.html file to allow HTML based welcome messages.
1 files modified
14 ■■■■■ changed files
server/plugins-available/mail_plugin.inc.php 14 ●●●●● patch | view | raw | blame | history
server/plugins-available/mail_plugin.inc.php
@@ -207,7 +207,14 @@
        //* Send the welcome email message
        $domain = explode('@', $data["new"]["email"])[1];
        if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
        $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');
@@ -236,8 +243,13 @@
        unset($tmp);
        $mailHeaders      = "MIME-Version: 1.0" . "\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"];