no message

This commit is contained in:
hellcat 2026-05-06 16:52:52 +08:00
parent 706fdf7a0e
commit 2853f48412
9 changed files with 149 additions and 45 deletions

View File

@ -60,7 +60,7 @@ return static function (Slim\App $app): void {
$app->get('/test4', App\Controllers\TestController::class . ':test4');
$app->get('/test5', App\Controllers\TestController::class . ':test5');
$app->get('/test6', App\Controllers\TestController::class . ':test6');
$app->get('/test_mail', App\Controllers\TestController::class . ':test_mail');
$app->get('/test_mail/{tpl}', App\Controllers\TestController::class . ':test_mail');
$app->get('/go/{method}', App\Controllers\TestController::class . ':go');
// $app->get('/test6', App\Controllers\TestController::class . ':test6');
// $app->get('/test6', App\Controllers\TestController::class . ':test6');

View File

@ -7,6 +7,20 @@
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet"/>
<style>
.bigTitleFu {
color: #333;
font-family: 'Open Sans', Tahoma, Verdana, sans-serif;
font-size: 22px;
font-weight: 600;
font-style: normal;
letter-spacing: normal;
line-height: 34px;
text-align: center;
padding: 0;
margin: 0;
}
.bigTitle {
color: #000000;
font-family: 'Open Sans', Tahoma, Verdana, sans-serif;
@ -20,6 +34,17 @@
margin: 0;
}
.midTextFu {
color: #333 !important;
font-family: 'Open Sans', Tahoma, Verdana, sans-serif !important;
font-size: 16px !important;
font-weight: 400 !important;
line-height: 22px !important;
text-align: center !important;
padding: 0 !important;
margin: 0 !important;
}
.midText {
color: #000000 !important;
font-family: 'Open Sans', Tahoma, Verdana, sans-serif !important;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,37 @@
{include file='header.tpl'}
<body style="background-color:#EEEEEE;">
<div style="text-align: center">
<div border="0" cellpadding="0" cellspacing="0" width="100%"
style="padding-top:30px;table-layout:fixed;background-color:#EEEEEE;" id="bodyTable">
<div align="center" valign="top" style="padding-right:10px;padding-left:10px;" id="bodyCell">
<div border="0" cellpadding="0" cellspacing="0"
style="background-color:#FFFFFF;max-width:600px;text-align: center; border-radius: 6px 6px 0px 0px;" width="100%" class="wrapperTable">
<div align="center" valign="top">
<div border="0" cellpadding="0" cellspacing="0" width="100%" class="logoTable">
<div align="center" valign="middle" style="padding-top:60px;padding-bottom:60px">
<h2 class="bigTitle" style="margin: 0 !important;">
邮箱验证
</h2>
</div>
</div>
</div>
</div>
<div border="0" cellpadding="0" cellspacing="0" style="max-width:600px;text-align: center" width="100%"
class="wrapperTable">
<div align="center" valign="top">
<div border="0" cellpadding="0" cellspacing="0" style="background-color:#FFFFFF; border-radius: 0px 0px 6px 6px;" width="100%"
class="oneColumn">
<div align="center" valign="top"
style="padding-bottom:60px;padding-left:20px;padding-right:20px;" class="description">
<p class="midText" style="margin: 0px !important;">
你请求的邮箱验证代码为: <b style="color:#505050">{$code}</b> <br>
本验证代码在 {$expire} 前有效。<br>
如果此验证码非你本人申请,请忽视此邮件。<br>
</p>
</div>
</div>
</div>
</div>
{include file='footer.tpl'}

View File

@ -18,7 +18,7 @@ use App\Services\Reward;
use App\Services\TomTool\Http;
use App\Services\TomTool\VisitorCount;
use App\Services\Mail;
use App\Command\Cron;
//session_start();
@ -28,14 +28,43 @@ final class TestController extends BaseController
public function test_mail(ServerRequest $request, Response $response, array $args)
{
$sTpl = $args["tpl"] ?? "";
if (!$sTpl) {
echo "需要tpl名";
exit;
}
switch ($sTpl) {
case "verify_code":
$sTextKey = "code";
break;
default:
$sTextKey = "text";
break;
}
$sTpl .= ".tpl";
$a = [];
$a[$sTextKey] = 123123;
$sReturn = Mail::getHtml($sTpl, $a);
echo $sReturn;
exit;
// tomd($args, 1);
// echo 123;exit;
return $response->write(
$this->view()
// ->assign('is_login', $user->isLogin)
// ->assign('taocan', $taocan)
->assign('text', "xxxxxx")
->fetch('email_test/warn.tpl')
);
// return $response->write(
// $this->view()
//// ->assign('is_login', $user->isLogin)
//// ->assign('taocan', $taocan)
// ->assign('text', "xxxxxx")
// ->fetch('email_test/warn.tpl')
// );
}
public function test5 ()

View File

@ -40,7 +40,7 @@ final class Mail
/**
* @throws Exception
*/
public static function genHtml($template, $ary): false|string
public static function getHtml($template, $ary): false|string
{
$smarty = new Smarty();
$smarty->setTemplateDir(BASE_PATH . '/resources/email/');
@ -64,14 +64,14 @@ final class Mail
*/
public static function send($to, $subject, $template, $array = []): void
{
$body = self::genHtml($template, $array);
$body = self::getHtml($template, $array);
self::getClient()->send($to, $subject, $body);
}
public static function send_bulk($to, $subject, $template, $array = [], $oSmtp = []): void
{
$body = self::genHtml($template, $array);
$body = self::getHtml($template, $array);
new Smtp_bulk($oSmtp)->send($to, $subject, $body);
}

View File

@ -21,6 +21,7 @@ use App\Services\Mail\Postal;
use App\Services\Mail\SendGrid;
use App\Services\Mail\Ses;
use App\Services\Mail\Smtp;
use App\Services\Mail as MailServices;
use Exception;
use Psr\Http\Client\ClientExceptionInterface;
use Smarty\Smarty;
@ -49,6 +50,17 @@ final class Mail extends Base
return $this->oDog->$sName($aArg[0]);
}
public function getHtml()
{
$a = [
"text" => 123123123
];
$s = MailServices::getHtml("one.tpl",$a);
return $s;
}
public function List()
{
$oMailArticle = ModelMailArticle::all();