Skip to content

Commit

Permalink
fixup! enable using announcements to add content to alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Dec 18, 2024
1 parent 21459ce commit a3f228c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/alertmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ function mlog($message) {

if ($banner) {
$email_text = $text_banner . $email_text;
$html_text = $html_banner . $html_text;
}

write_and_send_email($current, $email_text, $html_text, $template);
write_and_send_email($current, $email_text, $html_text, $template, $html_banner);
}
$current['email'] = $email;
$current['token'] = $alertitem['alert_id'] . '-' . $alertitem['registrationtoken'];
Expand Down Expand Up @@ -418,9 +417,8 @@ function mlog($message) {
if ($email_text) {
if ($banner) {
$email_text = $text_banner . $email_text;
$html_text = $html_banner . $html_text;
}
write_and_send_email($current, $email_text, $html_text, $template);
write_and_send_email($current, $email_text, $html_text, $template, $html_banner);
}

mlog("\n");
Expand Down Expand Up @@ -489,7 +487,7 @@ function sort_by_stuff($a, $b) {
return ($a['hpos'] > $b['hpos']) ? 1 : -1;
}

function write_and_send_email($current, $text, $html, $template) {
function write_and_send_email($current, $text, $html, $template, $html_banner) {
global $globalsuccess, $sentemails, $nomail, $start_time, $domain;

$text .= '====================';
Expand All @@ -499,8 +497,12 @@ function write_and_send_email($current, $text, $html, $template) {
$m = [
'DATA' => $text,
'_HTML_' => $html,
'_BANNER_' => '',
'MANAGE' => "https://$domain/D/" . $current['token'],
];
if ($html_banner) {
$m['_BANNER_'] = $html_banner;
}
if (!$nomail) {
$success = send_template_email($d, $m, true, true, $current['lang']); # true = "Precedence: bulk", want bounces
mlog("sent ... ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<a href="https://www.theyworkforyou.com">
<img src="images/theyworkforyou-logo.png" alt="" width="170">
</a>
{_BANNER_}
<h1 style="color: #333333; font-size: 21px; font-weight: 400; line-height: 21px; font-family: 'Source Sans Pro'; margin-top: 30px;">Email alerts</h1>
</header>

Expand Down

0 comments on commit a3f228c

Please sign in to comment.