Skip to content

Commit bc3a775

Browse files
author
Marius Burkard
committed
Merge branch 'html_welcome_mail' into 'stable-3.1'
Allow HTML based welcome messages I needed a HTML based welcome message, so I added this to mail_plugin.inc.php I hope this is the correct approach. 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. See merge request !276
2 parents a6e5304 + f571ae0 commit bc3a775

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (c) 2007-2016, Till Brehm, ISPConfig UG
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
* Neither the name of ISPConfig nor the names of its contributors
13+
may be used to endorse or promote products derived from this software without
14+
specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ISPConfig - Hosting Control Panel
2+
3+
- Manage multiple servers from one control panel
4+
- Web server management (Apache2 and nginx)
5+
- Mail server management (with virtual mail users)
6+
- DNS server management (BIND and MyDNS)
7+
- Virtualization (OpenVZ)
8+
- Administrator, reseller and client login
9+
- Configuration mirroring and clusters
10+
- Open Source software (BSD license)

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)