S2OJ/web/app/models/UOJMail.php

111 lines
14 KiB
PHP

<?php
use PHPMailer\PHPMailer\PHPMailer;
class UOJMail {
public static function noreply() {
$mailer = new PHPMailer();
$mailer->isSMTP();
$mailer->Host = UOJConfig::$data['mail']['noreply']['host'];
$mailer->Port = UOJConfig::$data['mail']['noreply']['port'];
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = UOJConfig::$data['mail']['noreply']['secure'];
$mailer->Username = UOJConfig::$data['mail']['noreply']['username'];
$mailer->Password = UOJConfig::$data['mail']['noreply']['password'];
$mailer->setFrom(UOJConfig::$data['mail']['noreply']['username'], UOJConfig::$data['profile']['oj-name-short']);
$mailer->CharSet = "utf-8";
$mailer->Encoding = "base64";
return $mailer;
}
public static function cronSendEmail() {
$emails = DB::selectAll([
"select * from emails",
"where", DB::land([
["created_at", ">=", DB::raw("addtime(now(), '-24:00:00')")],
"send_time" => null,
]),
"order by priority desc",
]);
$oj_name = UOJConfig::$data['profile']['oj-name'];
$oj_name_short = UOJConfig::$data['profile']['oj-name-short'];
$oj_url = HTML::url('/');
$oj_email_address = UOJConfig::$data['mail']['noreply']['username'];
foreach ($emails as $email) {
$user = UOJUser::query($email['receiver']);
$name = $user['username'];
if ($user['realname']) {
$name .= ' (' . $user['realname'] . ')';
}
if ($user['email']) {
$mailer = UOJMail::noreply();
$mailer->addAddress($user['email'], $user['username']);
$mailer->Subject = $email['subject'];
$mailer->msgHTML(<<<EOD
<base target="_blank" />
<div style="padding: 48px; margin: 60px auto 60px auto; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15), inset 0px 0px 1px rgba(0, 0, 0, 0.5); max-width: 700px">
<div style="display: block">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAGUmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN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sMTtXDADxG30XyVj7CtA+h+9OBs8iGzJdiOyCMieYSwbE4EdCdtWIvv8MGdYsUsAeJHepHPFLHZzrBszpf1GaAn+KHrchKx4/jmQdz3r7lxngRdzdzyE5O1OlnM8pzjQDYvAw0eFWg3g+1yJOuyokSmVjZrmsIFkNHsQzeih6nEA8r2dqtE2J/w+XbQI/4w+SoAAAAABJRU5ErkJggg==" height="32" width="32" style="margin: 0" />
<div style="font-size: 24px; font-weight: bold; display: inline-block; vertical-align: baseline; margin-left: 6px; line-height: 1">{$oj_name_short}</div>
</div>
<hr />
<br />
<h1><center>{$email['subject']}</center></h1>
<div style="font-size: 18px">{$name} 您好,</div>
<br />
<div>
{$email['content']}
</div>
<br />
<br />
<div style="text-align: right;">
<a href="{$oj_url}">{$oj_name}</a>
<br />
{$email['created_at']}
</div>
<br />
<hr />
<div style="font-size: 12px; color: grey; text-align: center;">
您之所以收到本邮件,是因为您是 {$oj_name} 的用户。
<br />
本邮件由系统自动发送,请勿回复。
<br />
若本邮件不是出现在正常收件箱内,请把我们的发信邮箱地址 {$oj_email_address} 添加到您的邮箱白名单内,以免错过重要通知。
</div>
</div>
EOD);
$res = retry_loop(function () use (&$mailer) {
$res = $mailer->send();
if ($res) return true;
UOJLog::error($mailer->ErrorInfo);
return false;
});
if ($res) {
DB::update("update emails set send_time = now() where id = {$email['id']}");
echo '[UOJMail::cronSendEmail] ID: ' . $email['id'] . ' sent.' . "\n";
}
} else {
DB::update("update emails set send_time = now() where id = {$email['id']}");
echo '[UOJMail::cronSendEmail] ID: ' . $email['id'] . ' - empty email address.' . "\n";
}
}
echo '[UOJMail::cronSendEmail] Done.' . "\n";
}
}