Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8642c1be7f | ||
|
|
2a82819ce8 | ||
|
|
97da1ae43a |
No files matched your search
@@ -41,7 +41,7 @@ class AutoReplyService
|
||||
$outHeaders['In-Reply-To'] = $headers['message-id'];
|
||||
$outHeaders['References'] = $headers['message-id'];
|
||||
}
|
||||
$html = view('mail.default.notify', array_replace([
|
||||
$html = view(config('mailflow.auto_reply_view', 'mail.default.notify'), array_replace([
|
||||
'name' => admin_setting('app_name', 'dpl'), 'url' => admin_setting('app_url', config('app.url')),
|
||||
'content' => e((string) Settings::get('auto_reply_text')),
|
||||
], Branding::values()))->render();
|
||||
|
||||
@@ -17,6 +17,8 @@ return [
|
||||
'imap_password' => env('MAIL_IMAP_PASSWORD'),
|
||||
'imap_folder' => 'INBOX',
|
||||
'auto_reply_enabled' => false,
|
||||
// An instance may brand incoming-mail replies without changing shared defaults.
|
||||
'auto_reply_view' => env('MAIL_AUTO_REPLY_VIEW', 'mail.default.notify'),
|
||||
'auto_reply_subject' => '我们已收到您的邮件',
|
||||
'auto_reply_text' => '您的邮件已收到,我们会尽快处理。',
|
||||
'report_enabled' => env('MAIL_REPORT_ENABLED', false),
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
## HN 邮件运行配置
|
||||
|
||||
HN六类普通邮件及来信自动回复已正式统一为独立HN样式,真实收件与启用/回退见[邮件主题](HN_MAIL_THEME.md);DPL模板与配置保持原样。
|
||||
|
||||
`/www/wwwroot/hardnerd.net/.env`、HN库的 `mail_flow` 设置;SMTP465 SSL与IMAP993 TLS均校验证书。旧Laravel读取 `MAIL_DRIVER`,已明确设smtp,不能只设MAIL_MAILER。发件名称hardnerd、地址及Reply-To均为自有邮箱,页脚主站hardnerd.net,空MAIL_LOGO_PATH避免沿用DPL图片。
|
||||
|
||||
验证码/登录链接/工单回复优先Resend,其他走企业SMTP;额度100/3000且使用官方用量与本地预占,规则沿 [BUSINESS_RULES](BUSINESS_RULES.md)。Resend密钥、IMAP密码与回调签名秘密在HN库加密;SMTP密码只在私有环境,未复制进普通后台可读设置。ACC-HN-MAIL与ACC-RESEND-HN私有字段按GemDocs读取,本文不存值。
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# HN 邮件主题
|
||||
|
||||
## 当前状态
|
||||
|
||||
2026-11-01用户明确批准“补齐并正式启用HN”后,已在sitejp02 HN实例启用全部六类普通邮件及来信自动回复,统一HN Logo、深灰底与绿色样式。本地HN也已同步六类模板及Logo/自动回复视图,保持本地mailflow关闭,没有本地真实发信或收件任务。DPL的环境、配置缓存、数据库模板、邮件设置、支付与用户订单基线均未改。
|
||||
|
||||
功能提交 `2a82819ce8ddb46625ee5a9e2f811d32449a58e2`;初稿设计提交97da1ae。已提交推送master、codex/hn-mail-design、codex/xb-unified-20261031,生产共用/www/wwwroot/xb/current从8c1a01a Git快进,保留原并行Stellar模板。此前“仅预览、尚未启用”为历史阶段。
|
||||
|
||||
## 覆盖范围与实现
|
||||
|
||||
| 源文件 | 用途 | 业务变量/备注 |
|
||||
| --- | --- | --- |
|
||||
| `resources/mail/hn/verify.html` | 邮箱验证码 | code;注册/找回等共用验证入口 |
|
||||
| `resources/mail/hn/mailLogin.html` | 邮件登录 | link |
|
||||
| `resources/mail/hn/notify.html` | 站点通知、工单回复、群发、管理员测试 | content;各用途原邮件标题保留 |
|
||||
| `resources/mail/hn/remindExpire.html` | 订阅即将到期 | 24小时提醒语义保留 |
|
||||
| `resources/mail/hn/serviceExpired.html` | 套餐已到期 | 档位及资格限制保留 |
|
||||
| `resources/mail/hn/remindTraffic.html` | 流量提醒 | 80%提醒语义保留 |
|
||||
| `resources/views/mail/hn/autoReply.blade.php` | 真实来信自动回复 | 原回复正文、当前网站地址与访问按钮 |
|
||||
|
||||
六份普通HTML通过HN独立v2_mail_templates覆盖,subject有意置空,使用现有MailService回退以保留验证码、工单及群发等各自业务标题;对应mail_template缓存已逐名清理。不新增数据库结构或邮件API,不复制其他实例数据/密钥。
|
||||
|
||||
本次获批核心仅两处:AutoReplyService按配置选择视图;config/mailflow.php新增MAIL_AUTO_REPLY_VIEW,默认mail.default.notify。HN环境单独设mail.hn.autoReply,DPL未配置时继续原默认视图,包括旧配置缓存兼容回退。原自动回复开启状态、正文、主题、北京时间每发件人每日一次、按父记录去重、退信/自动邮件过滤、原收件游标及回信头均保持。
|
||||
|
||||
HN单独MAIL_LOGO_PATH指向resources/mail/hn/logo.png;PNG由现有public/brand/hn/logo.svg无修改渲染为128px,展示44px。CID `site-logo@dpl` 仅是既有传输内部兼容标识,实际图片和可见品牌为HN。主题深灰底#111518、内容卡#1E242A、绿色#B4F047,单列600px表格、内联样式与480px窄屏样式,无远程图片/字体、脚本或追踪像素。
|
||||
|
||||
## 测试与真实收件验收
|
||||
|
||||
邮件全套、共享实例及管理员套餐回归87项504断言通过;包括六类经MailService实际渲染、业务标题保留、文字转义、PNG附件、HN自动回复选择、DPL默认兼容及防循环/按日去重。自动回复正文新增动态站点地址后,两项相关选择/转义回归再次通过。
|
||||
|
||||
用户指定的当前Proton账号已由页面账号标识核对,具体私人收件地址仅保留私有回执,不复制到普通Git。真实验收:
|
||||
|
||||
- 初稿通知:HN MailMessage7,SMTP submitted,Proton已收到并打开。
|
||||
- 初稿验证码:第一次测试键含点号导致Resend HTTP422(8,failed、无provider_id);仅修正测试键后9经Resend submitted并收到。服务商字段限制见[官方规范](https://github.com/resend/resend-openapi/blob/main/resend.yaml)。旧失败记录保留,不重发通知,不改核心。
|
||||
- 正式启用后,邮件登录12、即将到期13、已到期14、流量提醒15,均经MailService选择db:对应模板,原测试标题保留、SMTP submitted;四封均在Proton收到并打开,标题、Logo、正文与按钮显示核对通过。测试不创建真实验证码或登录凭证,不变更真实用户套餐。
|
||||
- 用户批准的一封Proton来信,已在已发送确认,HN IMAP INBOX UID4/UIDVALIDITY1793103379正常入库16;AutoReplyService生成17,原Horizon经SMTP提交一次并在Proton收到、打开,HN Logo、新样式及动态https://hardnerd.net地址显示通过。日去重仍为1,无重复回信。
|
||||
|
||||
最初按完整主题查询未匹配该来信,不能据此认定漏收;随后用IMAP唯一键确认原信和回复均已正常处理。中间一次既有带锁轮询返回0;未重新发送来信、回退游标、重扫历史、改反垃圾规则或手动补造入站记录。
|
||||
|
||||
本轮实际收件覆盖六类模板及独立自动回复。工单/群发复用notify,并通过六模板真实渲染回归核对,不为验收创建客户工单或给真实客户群发。Proton桌面显示已验收,不扩大为所有客户端/手机或真实用户订阅到期触发验收。本机仅访问用户指定第三方邮箱,未访问HN/DPL项目线上页面。
|
||||
|
||||
## 发布、备份与运行
|
||||
|
||||
私有备份:sitejp02 `/root/codex-backups/hn-mail-theme/20261101-full/`,目录700、私密副本600;保存两实例原环境/配置缓存、HN原模板、变更源文件、版本、Git差异、启用与实发回执。初稿试发回执另存 `/root/codex-backups/hn-mail-design/20261101-v1/`。本地HN备份在忽略目录codex/output/hn-mail-design-20261101/local-private-backup/,不提交Git。
|
||||
|
||||
仅HN配置缓存按hn身份重建;定点刷新相关OPcache,不做全局重启。HN Horizon正常终止后,现有systemd Restart=on-failure不会自动拉起成功退出的进程;已显式start并核对HN/DPL Horizon及php8.4-fpm均active,未修改Restart策略。后续优雅重载必须按实际Restart策略核对并显式启动,不能只执行horizon:terminate就声称已恢复。
|
||||
|
||||
## 回退
|
||||
|
||||
仅恢复HN六个指定模板名的原记录,不能整表覆盖随后新增配置;逐名清理mail_template缓存。仅将HN MAIL_AUTO_REPLY_VIEW、MAIL_LOGO_PATH恢复为发布前值/缺省状态,重建仅HN配置缓存并按上述策略重载HN队列。保留所有已发送/入站/投递记录与IMAP游标,不删除事件或重发历史邮件。DPL配置与模板不参与回退;需要代码回退时只回退本任务相关改动,保留并行提交与Stellar本地差异。原MAIL_DRIVER、SMTP/IMAP、Resend及邮件档位均未变。
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>登录确认 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">登录确认 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">登录确认</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">点击下方按钮登录 HardNerd,链接有效期为 5 分钟。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{link}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">确认登录</a></td></tr></table><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">如非本人操作,请忽略此邮件。请勿将登录链接转发给他人。</p><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">按钮无法打开时,可复制此链接到浏览器:<br><a href="{{link}}" style="color:#B4F047;text-decoration:underline;word-break:break-all;">{{link}}</a></p>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"brand": "hn",
|
||||
"version": 1,
|
||||
"status": "production",
|
||||
"active_by_default": false,
|
||||
"templates": [
|
||||
{
|
||||
"name": "verify",
|
||||
"subject": "HardNerd · 邮箱验证码",
|
||||
"file": "verify.html",
|
||||
"required_vars": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "notify",
|
||||
"subject": "HardNerd · 站点通知",
|
||||
"file": "notify.html",
|
||||
"required_vars": [
|
||||
"content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mailLogin",
|
||||
"subject": "HardNerd · 登录确认",
|
||||
"file": "mailLogin.html",
|
||||
"required_vars": [
|
||||
"link"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "remindExpire",
|
||||
"subject": "HardNerd · 订阅即将到期",
|
||||
"file": "remindExpire.html",
|
||||
"required_vars": []
|
||||
},
|
||||
{
|
||||
"name": "serviceExpired",
|
||||
"subject": "HardNerd · 套餐已到期",
|
||||
"file": "serviceExpired.html",
|
||||
"required_vars": []
|
||||
},
|
||||
{
|
||||
"name": "remindTraffic",
|
||||
"subject": "HardNerd · 流量使用提醒",
|
||||
"file": "remindTraffic.html",
|
||||
"required_vars": []
|
||||
}
|
||||
],
|
||||
"logo": "logo.png",
|
||||
"logo_content_id": "site-logo@dpl",
|
||||
"compatibility_note": "Existing mail transport CID retained; image and visible branding are HN only.",
|
||||
"auto_reply_view": "mail.hn.autoReply",
|
||||
"activation_scope": "HN instance database templates and environment only"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>站点通知 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">站点通知 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">站点通知</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">{{content}}</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">前往查看</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>订阅即将到期 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">订阅即将到期 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">订阅即将到期</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的订阅服务将在 <strong style="color:#F1F4F0;">24 小时内到期</strong>。</p><p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">为避免服务中断,请及时续费。如已完成续费,请忽略此提醒。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">管理订阅</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>流量使用提醒 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">流量使用提醒 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">流量使用提醒</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的套餐流量已使用 <strong style="color:#F1F4F0;">80%</strong>。</p><p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">请留意剩余流量,您可以在控制台查看详细使用情况。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">查看用量</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>套餐已到期 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">套餐已到期 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">套餐已到期</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">您的套餐已到期。如需继续使用,请前往网站续费。</p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">前往续费</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>邮箱验证码 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">邮箱验证码 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">邮箱验证码</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">请使用以下验证码完成验证。</p><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td bgcolor="#14191D" style="padding:24px 16px;border:1px solid #39442E;border-radius:6px;text-align:center;"><span style="font-family:'Courier New',Courier,monospace;font-size:34px;line-height:44px;letter-spacing:8px;font-weight:700;color:#B4F047;">{{code}}</span></td></tr></table><p style="margin:22px 0 0;color:#939CA6;font-size:12px;line-height:21px;">验证码有效期为 5 分钟,请勿转发或透露给他人。如非本人操作,请忽略此邮件。</p>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{site_url|https://hardnerd.net}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">[email protected]</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><meta name="color-scheme" content="dark"><meta name="supported-color-schemes" content="dark"><title>来信已收到 · HardNerd</title>
|
||||
<style>@media only screen and (max-width:480px){.hn-shell{width:100%!important}.hn-pad{padding-left:24px!important;padding-right:24px!important}.hn-outer{padding:20px 12px!important}.hn-title{font-size:24px!important;line-height:34px!important}}a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important}</style></head>
|
||||
<body bgcolor="#111518" style="margin:0;padding:0;background-color:#111518;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;color:#EDF1F4;-webkit-text-size-adjust:100%;">
|
||||
<div style="display:none;font-size:1px;color:#111518;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all;">来信已收到 · HardNerd 账户与服务邮件</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#111518" style="background-color:#111518;"><tr><td class="hn-outer" align="center" style="padding:40px 16px;">
|
||||
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0"><tr><td><![endif]-->
|
||||
<table class="hn-shell" role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;table-layout:fixed;">
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:28px 36px;background-color:#1E242A;border:1px solid #353D44;border-bottom:0;border-radius:10px 10px 0 0;">
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td width="48" valign="middle" style="width:48px;padding-right:12px;"><img src="cid:site-logo@dpl" width="44" height="44" alt="HardNerd" style="display:block;width:44px;height:44px;border:0;border-radius:10px;"></td><td valign="middle" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:24px;line-height:30px;letter-spacing:-0.7px;color:#F2F4F1;font-weight:750;">Hard<span style="color:#B4F047;">Nerd</span></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="#1E242A" style="background-color:#1E242A;border-left:1px solid #353D44;border-right:1px solid #353D44;padding:0 36px;"><table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td height="1" bgcolor="#39432F" style="height:1px;background-color:#39432F;font-size:0;line-height:0;"> </td></tr></table></td></tr>
|
||||
<tr><td class="hn-pad" bgcolor="#1E242A" style="padding:32px 36px 36px;background-color:#1E242A;border:1px solid #353D44;border-top:0;border-radius:0 0 10px 10px;">
|
||||
<h1 class="hn-title" style="margin:0 0 20px;font-size:27px;line-height:38px;letter-spacing:-0.4px;font-weight:700;color:#F2F4F1;">来信已收到</h1>
|
||||
<p style="margin:0 0 18px;color:#C5CBD2;font-size:15px;line-height:26px;word-break:break-word;overflow-wrap:anywhere;">{!! nl2br($content) !!}</p><p style="margin:0 0 22px;color:#C5CBD2;font-size:15px;line-height:26px;">当前网站地址:<br><a href="{{$site_url ?? $url}}" style="color:#B4F047;font-weight:700;text-decoration:none;word-break:break-all;">{{$site_url ?? $url}}</a></p><table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#B4F047" style="background-color:#B4F047;border-radius:6px;text-align:center;mso-padding-alt:14px 28px;"><a href="{{$url}}" style="display:inline-block;padding:14px 28px;border:1px solid #B4F047;border-radius:6px;background-color:#B4F047;color:#141A12;font-size:15px;line-height:22px;font-weight:700;text-decoration:none;">访问 HardNerd</a></td></tr></table>
|
||||
</td></tr>
|
||||
<tr><td class="hn-pad" align="left" style="padding:22px 36px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;font-size:12px;line-height:22px;color:#8D979F;">此邮件由 HardNerd 系统发送。<br><a href="{{$site_url ?? 'https://hardnerd.net'}}" style="color:#B4F047;text-decoration:none;">hardnerd.net</a><span style="color:#59636D;"> / </span><a href="mailto:[email protected]" style="color:#AAB4BC;text-decoration:none;">mail@hardnerd.dev</a></td></tr>
|
||||
</table><!--[if mso]></td></tr></table><![endif]-->
|
||||
</td></tr></table></body></html>
|
||||
@@ -256,6 +256,55 @@ class MailFlowTest extends TestCase
|
||||
$this->assertSame('conventional', $reply->refresh()->channel);
|
||||
}
|
||||
|
||||
public function test_instance_auto_reply_view_uses_hn_brand_and_keeps_escape_headers_and_subject(): void
|
||||
{
|
||||
config(['mailflow.auto_reply_enabled'=>true,'mailflow.auto_reply_view'=>'mail.hn.autoReply',
|
||||
'mailflow.logo_path'=>base_path('resources/mail/hn/logo.png'),
|
||||
'mailflow.auto_reply_subject'=>'Original reply subject','mailflow.auto_reply_text'=>"Latest address\n<script>not executable</script>"]);
|
||||
$incoming=MailMessage::create(['message_key'=>'hn-incoming','direction'=>'in','purpose'=>'incoming','email'=>'[email protected]','subject'=>'Help','status'=>'received']);
|
||||
$reply=app(AutoReplyService::class)->prepare($incoming,['message-id'=>'<[email protected]>']);
|
||||
$this->assertNotNull($reply);$this->assertSame('Original reply subject',$reply->subject);
|
||||
$this->assertStringContainsString('Hard<span',$reply->payload['html']);
|
||||
$this->assertStringContainsString('#B4F047',$reply->payload['html']);
|
||||
$this->assertStringContainsString('<script>',$reply->payload['html']);
|
||||
$this->assertStringNotContainsString('<script>',$reply->payload['html']);
|
||||
$this->assertSame('auto-replied',$reply->payload['headers']['Auto-Submitted']);
|
||||
$this->assertSame('<[email protected]>',$reply->payload['headers']['In-Reply-To']);
|
||||
$this->assertSame(file_get_contents(base_path('resources/mail/hn/logo.png')),base64_decode($reply->payload['attachments'][0]['content']));
|
||||
$this->assertNull(app(AutoReplyService::class)->prepare($incoming,[]));
|
||||
}
|
||||
|
||||
public function test_default_auto_reply_view_remains_legacy_for_other_instances(): void
|
||||
{
|
||||
$this->assertSame('mail.default.notify',config('mailflow.auto_reply_view'));
|
||||
config(['mailflow.auto_reply_enabled'=>true]);
|
||||
$incoming=MailMessage::create(['message_key'=>'default-incoming','direction'=>'in','purpose'=>'incoming','email'=>'[email protected]','subject'=>'Help','status'=>'received']);
|
||||
$reply=app(AutoReplyService::class)->prepare($incoming,[]);
|
||||
$this->assertStringContainsString('#142542',$reply->payload['html']);
|
||||
$this->assertStringNotContainsString('Hard<span',$reply->payload['html']);
|
||||
}
|
||||
|
||||
public function test_all_six_hn_templates_render_through_mail_service_preserving_business_subject(): void
|
||||
{
|
||||
Schema::create('v2_mail_templates',function(Blueprint $t){$t->id();$t->string('name');$t->string('subject');$t->text('content');$t->timestamps();});
|
||||
Schema::create('v2_mail_log',function(Blueprint $t){$t->id();$t->string('email');$t->string('subject');$t->string('template_name');$t->text('error')->nullable();$t->integer('created_at')->nullable();$t->integer('updated_at')->nullable();});
|
||||
config(['mailflow.logo_path'=>base_path('resources/mail/hn/logo.png')]);
|
||||
$manifest=json_decode(file_get_contents(base_path('resources/mail/hn/manifest.json')),true);
|
||||
$dispatcher=Mockery::mock(Dispatcher::class);
|
||||
$dispatcher->shouldReceive('send')->times(6)->withArgs(function($params,$subject,$html){
|
||||
$this->assertSame('Preserved purpose-specific subject',$subject);
|
||||
$this->assertStringContainsString('Hard<span',$html);$this->assertStringContainsString('#B4F047',$html);
|
||||
$this->assertDoesNotMatchRegularExpression('/\{\{[A-Za-z_]/',$html);
|
||||
$this->assertStringNotContainsString('<script>',$html);$this->assertCount(1,$params['attachments']);return true;
|
||||
})->andReturn(['status'=>'submitted','error'=>null]);$this->app->instance(Dispatcher::class,$dispatcher);
|
||||
foreach($manifest['templates'] as $item){
|
||||
\App\Models\MailTemplate::create(['name'=>$item['name'],'subject'=>'','content'=>file_get_contents(base_path('resources/mail/hn/'.$item['file']))]);
|
||||
$out=\App\Services\MailService::sendEmail(['email'=>'[email protected]','subject'=>'Preserved purpose-specific subject','template_name'=>$item['name'],'purpose'=>'admin_test',
|
||||
'template_value'=>['name'=>'HardNerd','url'=>'https://example.com','link'=>'https://example.com/login','code'=>'123456','content'=>'<script>not executable</script>','content_mode'=>'text']]);
|
||||
$this->assertSame('submitted',$out['status']);$this->assertSame('db:'.$item['name'],$out['template_name']);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_auto_reply_skips_automated_bulk_and_own_messages(): void
|
||||
{
|
||||
config(['mailflow.auto_reply_enabled' => true]);
|
||||
|
||||
Reference in new issue
Block a user