public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] Optional HTML in system mails (#3879)
* HTML in system mails * Update functions.inc.php * Update functions.inc.php Co-authored-by: André Peters <[email protected]>
dd1b25fa
data/web/admin.php | 7 +++++++
data/web/inc/functions.inc.php | 9 ++++++++-
data/web/lang/lang.en.json | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
Diff
diff --git a/data/web/admin.php b/data/web/admin.php
index e522dcfe..f2d6cfb4 100644
--- a/data/web/admin.php
+++ b/data/web/admin.php
@@ -1278,6 +1278,13 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
<textarea class="form-control" rows="10" name="mass_text" id="mass_text" required></textarea>
</div>
</div>
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="mass_html"><?=$lang['admin']['html'];?> (<?=$lang['admin']['optional'];?>):</label>
+ <div class="col-sm-10">
+ <textarea class="form-control" rows="10" name="mass_html" id="mass_html"></textarea>
+ <p class="small">↪ <a target="_blank" href="https://templates.mailchimp.com/resources/html-to-text/"><?=$lang['admin']['convert_html_to_text'];?></a></p>
+ </div>
+ </div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php
index 21852259..c49cccb2 100644
--- a/data/web/inc/functions.inc.php
+++ b/data/web/inc/functions.inc.php
@@ -143,6 +143,7 @@ function sys_mail($_data) {
$mailboxes = array();
$mass_from = $_data['mass_from'];
$mass_text = $_data['mass_text'];
+ $mass_html = $_data['mass_html'];
$mass_subject = $_data['mass_subject'];
if (!filter_var($mass_from, FILTER_VALIDATE_EMAIL)) {
$_SESSION['return'][] = array(
@@ -202,7 +203,13 @@ function sys_mail($_data) {
$mail->setFrom($mass_from);
$mail->Subject = $mass_subject;
$mail->CharSet ="UTF-8";
- $mail->Body = $mass_text;
+ if (!empty($mass_html)) {
+ $mail->Body = $mass_html;
+ $mail->AltBody = $mass_text;
+ }
+ else {
+ $mail->Body = $mass_text;
+ }
$mail->XMailer = 'MooMassMail';
foreach ($rcpts as $rcpt) {
$mail->AddAddress($rcpt);
diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json
index 0452cfb3..1e9a4534 100644
--- a/data/web/lang/lang.en.json
+++ b/data/web/lang/lang.en.json
@@ -139,6 +139,7 @@
"ban_list_info": "See a list of banned IPs below: <b>network (remaining ban time) - [actions]</b>.<br />IPs queued to be unbanned will be removed from the active ban list within a few seconds.<br />Red labels indicate active permanent bans by blacklisting.",
"change_logo": "Change logo",
"configuration": "Configuration",
+ "convert_html_to_text": "Convert HTML to plain text",
"credentials_transport_warning": "<b>Warning</b>: Adding a new transport map entry will update the credentials for all entries with a matching nexthop column.",
"customer_id": "Customer ID",
"customize": "Customize",
@@ -190,6 +191,7 @@
"hash_remove_info": "Removing a ratelimit hash (if still existing) will reset its counter completely.<br>\r\n Each hash is indicated by an individual color.",
"help_text": "Override help text below login mask (HTML allowed)",
"host": "Host",
+ "html": "HTML",
"import": "Import",
"import_private_key": "Import private key",
"in_use_by": "In use by",
@@ -218,6 +220,7 @@
"oauth2_redirect_uri": "Redirect URI",
"oauth2_renew_secret": "Generate new client secret",
"oauth2_revoke_tokens": "Revoke all client tokens",
+ "optional": "optional",
"password": "Password",
"password_repeat": "Confirmation password (repeat)",
"priority": "Priority",