[Web] Optional HTML in system mails (#3879)

* HTML in system mails

* Update functions.inc.php

* Update functions.inc.php

Co-authored-by: André Peters <andre.peters@debinux.de>
master
Balázs Dura-Kovács 2020-11-30 07:43:48 +01:00 committed by GitHub
parent cf78855927
commit dd1b25fa61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -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> <textarea class="form-control" rows="10" name="mass_text" id="mass_text" required></textarea>
</div> </div>
</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="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<label> <label>

View File

@ -143,6 +143,7 @@ function sys_mail($_data) {
$mailboxes = array(); $mailboxes = array();
$mass_from = $_data['mass_from']; $mass_from = $_data['mass_from'];
$mass_text = $_data['mass_text']; $mass_text = $_data['mass_text'];
$mass_html = $_data['mass_html'];
$mass_subject = $_data['mass_subject']; $mass_subject = $_data['mass_subject'];
if (!filter_var($mass_from, FILTER_VALIDATE_EMAIL)) { if (!filter_var($mass_from, FILTER_VALIDATE_EMAIL)) {
$_SESSION['return'][] = array( $_SESSION['return'][] = array(
@ -202,7 +203,13 @@ function sys_mail($_data) {
$mail->setFrom($mass_from); $mail->setFrom($mass_from);
$mail->Subject = $mass_subject; $mail->Subject = $mass_subject;
$mail->CharSet ="UTF-8"; $mail->CharSet ="UTF-8";
if (!empty($mass_html)) {
$mail->Body = $mass_html;
$mail->AltBody = $mass_text;
}
else {
$mail->Body = $mass_text; $mail->Body = $mass_text;
}
$mail->XMailer = 'MooMassMail'; $mail->XMailer = 'MooMassMail';
foreach ($rcpts as $rcpt) { foreach ($rcpts as $rcpt) {
$mail->AddAddress($rcpt); $mail->AddAddress($rcpt);

View File

@ -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.", "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", "change_logo": "Change logo",
"configuration": "Configuration", "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.", "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", "customer_id": "Customer ID",
"customize": "Customize", "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.", "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)", "help_text": "Override help text below login mask (HTML allowed)",
"host": "Host", "host": "Host",
"html": "HTML",
"import": "Import", "import": "Import",
"import_private_key": "Import private key", "import_private_key": "Import private key",
"in_use_by": "In use by", "in_use_by": "In use by",
@ -218,6 +220,7 @@
"oauth2_redirect_uri": "Redirect URI", "oauth2_redirect_uri": "Redirect URI",
"oauth2_renew_secret": "Generate new client secret", "oauth2_renew_secret": "Generate new client secret",
"oauth2_revoke_tokens": "Revoke all client tokens", "oauth2_revoke_tokens": "Revoke all client tokens",
"optional": "optional",
"password": "Password", "password": "Password",
"password_repeat": "Confirmation password (repeat)", "password_repeat": "Confirmation password (repeat)",
"priority": "Priority", "priority": "Priority",