Skip to content

Commit be2cd73

Browse files
committed
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 parent eca13b9 commit be2cd73

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

server/plugins-available/mail_plugin.inc.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,14 @@ function user_insert($event_name, $data) {
207207

208208
//* Send the welcome email message
209209
$domain = explode('@', $data["new"]["email"])[1];
210-
if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
210+
$html = False;
211+
if (file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html')) {
212+
$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.html');
213+
$html = True;
214+
} elseif (file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html')) {
215+
$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.html');
216+
$html = True;
217+
} elseif (file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt')) {
211218
$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$domain.'.txt');
212219
} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
213220
$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
@@ -236,8 +243,13 @@ function user_insert($event_name, $data) {
236243
unset($tmp);
237244

238245
$mailHeaders = "MIME-Version: 1.0" . "\n";
239-
$mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n";
240-
$mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n";
246+
if ($html){
247+
$mailHeaders .= "Content-Type: text/html; charset=utf-8" . "\n";
248+
$mailHeaders .= "Content-Transfer-Encoding: quoted-printable" . "\n";
249+
} else {
250+
$mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n";
251+
$mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n";
252+
}
241253
$mailHeaders .= "From: $welcome_mail_from" . "\n";
242254
$mailHeaders .= "Reply-To: $welcome_mail_from" . "\n";
243255
$mailTarget = $data["new"]["email"];

0 commit comments

Comments
 (0)