feat: configure gitea smtp mail templates

This commit is contained in:
2026-08-17 01:56:43 +08:00
parent 71d1eda877
commit 854764fc00
4 changed files with 97 additions and 0 deletions
+3
View File
@@ -1,2 +1,5 @@
MARIADB_ROOT_PASSWORD=replace-with-a-long-random-password MARIADB_ROOT_PASSWORD=replace-with-a-long-random-password
MARIADB_PASSWORD=replace-with-another-long-random-password MARIADB_PASSWORD=replace-with-another-long-random-password
GITEA_MAILER_FROM=noreply@git.roncarve.com
GITEA_MAILER_USER=noreply@git.roncarve.com
GITEA_MAILER_PASSWORD=replace-with-tencent-cloud-smtp-password
+7
View File
@@ -21,7 +21,14 @@ services:
GITEA__database__NAME: gitea GITEA__database__NAME: gitea
GITEA__database__USER: gitea GITEA__database__USER: gitea
GITEA__database__PASSWD: ${MARIADB_PASSWORD} GITEA__database__PASSWD: ${MARIADB_PASSWORD}
GITEA__mailer__ENABLED: "true"
GITEA__mailer__PROTOCOL: smtps GITEA__mailer__PROTOCOL: smtps
GITEA__mailer__SMTP_ADDR: smtp.qcloudmail.com
GITEA__mailer__SMTP_PORT: "465"
GITEA__mailer__FROM: '"代码协作平台-海南荣刻科技有限公司" <${GITEA_MAILER_FROM}>'
GITEA__mailer__ENVELOPE_FROM: ${GITEA_MAILER_FROM}
GITEA__mailer__USER: ${GITEA_MAILER_USER}
GITEA__mailer__PASSWD: ${GITEA_MAILER_PASSWORD}
ports: ports:
- "2222:22" - "2222:22"
volumes: volumes:
@@ -0,0 +1,49 @@
海南荣刻科技有限公司|账号信息
---
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
<title>账号信息</title>
</head>
<body style="margin:0;padding:24px;background:#f5f7fa;color:#1f2937;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;line-height:1.7;">
{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}}
<div style="max-width:620px;margin:0 auto;background:#ffffff;border:1px solid #e5e7eb;border-radius:10px;padding:32px;">
<h2 style="margin:0 0 24px;color:#111827;font-size:22px;">账号信息</h2>
<p>{{.DisplayName}},您好:</p>
<p>海南荣刻科技有限公司已为您开通代码协作平台账号。</p>
<p>
用户名:<strong>{{.Username}}</strong>
</p>
<p>请点击下面的链接设置登录密码:</p>
<p>
<a href="{{$set_pwd_url}}" style="display:inline-block;padding:10px 18px;border-radius:6px;background:#2563eb;color:#ffffff;text-decoration:none;">完成账号设置</a>
</p>
<p style="word-break:break-all;color:#4b5563;font-size:13px;">{{$set_pwd_url}}</p>
<p>完成账号设置后,可通过以下地址访问平台:</p>
<p>
<a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a>
</p>
<p style="margin-top:28px;color:#6b7280;font-size:13px;">
如果您并未预期收到此邮件,请联系管理员确认。<br>
本邮件由系统自动发送,请勿直接回复。
</p>
<p style="margin:24px 0 0;color:#374151;">
海南荣刻科技有限公司<br>
代码协作平台<br>
{{AppUrl}}
</p>
</div>
</body>
</html>
@@ -0,0 +1,38 @@
海南荣刻科技有限公司|账号访问链接
---
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
<title>账号访问链接</title>
</head>
<body style="margin:0;padding:24px;background:#f5f7fa;color:#1f2937;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei',Arial,sans-serif;line-height:1.7;">
{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
<div style="max-width:620px;margin:0 auto;background:#ffffff;border:1px solid #e5e7eb;border-radius:10px;padding:32px;">
<h2 style="margin:0 0 24px;color:#111827;font-size:22px;">账号访问链接</h2>
<p>{{.DisplayName}},您好:</p>
<p>我们收到了一次账号访问设置请求。</p>
<p>请在 {{.ResetPwdCodeLives}} 内点击下面的链接完成设置:</p>
<p>
<a href="{{$recover_url}}" style="display:inline-block;padding:10px 18px;border-radius:6px;background:#2563eb;color:#ffffff;text-decoration:none;">继续操作</a>
</p>
<p style="word-break:break-all;color:#4b5563;font-size:13px;">{{$recover_url}}</p>
<p style="margin-top:24px;color:#6b7280;font-size:13px;">
如果您没有发起本次请求,可以忽略此邮件。为保障账号安全,请勿将此链接转发给他人。
</p>
<p style="margin:24px 0 0;color:#374151;">
海南荣刻科技有限公司<br>
代码协作平台<br>
{{AppUrl}}
</p>
</div>
</body>
</html>