mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-06 23:21:16 +08:00
🔧 配置文件和部署文档新增 resend 邮箱服务
This commit is contained in:
@@ -103,9 +103,9 @@ SERVER_PORT=8082
|
||||
```
|
||||
|
||||
3. 执行 [`db/init/init_script.sql`](backend/src/main/resources/db/init/init_script.sql) 脚本,导入基本的数据
|
||||
管理员:**adminmail@openisle.com/123456**
|
||||
普通用户1:**usermail1@openisle.com/123456**
|
||||
普通用户2:**usermail2@openisle.com/123456**
|
||||
管理员:**admin/123456**
|
||||
普通用户1:**user1/123456**
|
||||
普通用户2:**user2/123456**
|
||||
|
||||

|
||||
|
||||
@@ -225,3 +225,24 @@ npm run dev
|
||||

|
||||
|
||||

|
||||
|
||||
### 配置 Resend 邮箱服务
|
||||
|
||||
https://resend.com/emails 创建账号并登录
|
||||
|
||||
- `Domains` -> `Add Domain`
|
||||

|
||||
|
||||
- 填写域名
|
||||

|
||||
|
||||
- 等待一段时间后解析成功,创建 key
|
||||
`API Keys` -> `Create API Key`,输入名称,设置 `Permission` 为 `Sending access`
|
||||
**Key 只能查看一次,务必保存下来**
|
||||

|
||||

|
||||

|
||||
- 修改 `.env` 配置中的 `RESEND_API_KEY` 和 `RESEND_FROM_EMAIL`
|
||||
`RESEND_FROM_EMAIL`: **noreply@域名**
|
||||
`RESEND_API_KEY`:**刚刚复制的 Key**
|
||||

|
||||
|
||||
BIN
assets/contributing/image-20250906150459400.png
Normal file
BIN
assets/contributing/image-20250906150459400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
BIN
assets/contributing/image-20250906150541817.png
Normal file
BIN
assets/contributing/image-20250906150541817.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 183 KiB |
BIN
assets/contributing/image-20250906150811572.png
Normal file
BIN
assets/contributing/image-20250906150811572.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
BIN
assets/contributing/image-20250906150924975.png
Normal file
BIN
assets/contributing/image-20250906150924975.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/contributing/image-20250906150944130.png
Normal file
BIN
assets/contributing/image-20250906150944130.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/contributing/image-20250906151218330.png
Normal file
BIN
assets/contributing/image-20250906151218330.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -19,6 +19,7 @@ REDIS_PORT=<Redis 端口>
|
||||
|
||||
# === Resend ===
|
||||
RESEND_API_KEY=<你的resend-api-key>
|
||||
RESEND_FROM_EMAIL=<你的 resend 发送邮箱>
|
||||
|
||||
# === COS ===
|
||||
# COS_BASE_URL=https://<你的cos>.cos.ap-guangzhou.myqcloud.com
|
||||
|
||||
@@ -18,6 +18,9 @@ public class ResendEmailSender extends EmailSender {
|
||||
@Value("${resend.api.key}")
|
||||
private String apiKey;
|
||||
|
||||
@Value("${resend.from.email}")
|
||||
private String fromEmail;
|
||||
|
||||
private final RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
@Override
|
||||
@@ -33,7 +36,7 @@ public class ResendEmailSender extends EmailSender {
|
||||
body.put("to", to);
|
||||
body.put("subject", subject);
|
||||
body.put("text", text);
|
||||
body.put("from", "openisle <noreply@chenjiating.com>"); // todo(tim): use config
|
||||
body.put("from", "openisle <" + fromEmail + ">");
|
||||
|
||||
HttpEntity<Map<String, String>> entity = new HttpEntity<>(body, headers);
|
||||
restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||
|
||||
@@ -56,6 +56,7 @@ app.captcha.comment-enabled=${CAPTCHA_COMMENT_ENABLED:false}
|
||||
# ========= Optional =========
|
||||
# for resend email send service, you can improve your service by yourself
|
||||
resend.api.key=${RESEND_API_KEY:}
|
||||
resend.from.email=${RESEND.FROM.EMAIL}
|
||||
# your email services: ...
|
||||
|
||||
# for tencent cloud image upload service, you can improve your service by yourself
|
||||
|
||||
Reference in New Issue
Block a user