Skip to content

Commit 273d325

Browse files
author
Lasim
committed
feat(backend): add endpoint to send test email and validate SMTP configuration
1 parent 9b52c0a commit 273d325

File tree

3 files changed

+462
-0
lines changed

3 files changed

+462
-0
lines changed

services/backend/api-spec.json

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19388,6 +19388,203 @@
1938819388
}
1938919389
}
1939019390
},
19391+
"/api/admin/email/test": {
19392+
"post": {
19393+
"summary": "Send test email",
19394+
"tags": [
19395+
"Admin Email"
19396+
],
19397+
"description": "Sends a test email to verify SMTP configuration. Only global administrators can access this endpoint. Requires Content-Type: application/json header when sending request body.",
19398+
"requestBody": {
19399+
"content": {
19400+
"application/json": {
19401+
"schema": {
19402+
"type": "object",
19403+
"properties": {
19404+
"email": {
19405+
"type": "string",
19406+
"format": "email"
19407+
}
19408+
},
19409+
"required": [
19410+
"email"
19411+
],
19412+
"additionalProperties": false
19413+
}
19414+
}
19415+
},
19416+
"required": true
19417+
},
19418+
"security": [
19419+
{
19420+
"cookieAuth": []
19421+
}
19422+
],
19423+
"responses": {
19424+
"200": {
19425+
"description": "Default Response",
19426+
"content": {
19427+
"application/json": {
19428+
"schema": {
19429+
"schema": {
19430+
"description": "Test email sent successfully",
19431+
"type": "object",
19432+
"properties": {
19433+
"success": {
19434+
"description": "Indicates if the test email was sent successfully",
19435+
"type": "boolean"
19436+
},
19437+
"message": {
19438+
"description": "Success message",
19439+
"type": "string"
19440+
},
19441+
"messageId": {
19442+
"description": "Email message ID from SMTP server",
19443+
"type": "string"
19444+
},
19445+
"recipients": {
19446+
"description": "List of email recipients",
19447+
"type": "array",
19448+
"items": {
19449+
"type": "string"
19450+
}
19451+
}
19452+
},
19453+
"required": [
19454+
"success",
19455+
"message",
19456+
"recipients"
19457+
],
19458+
"additionalProperties": false
19459+
},
19460+
"components": {}
19461+
}
19462+
}
19463+
}
19464+
},
19465+
"400": {
19466+
"description": "Default Response",
19467+
"content": {
19468+
"application/json": {
19469+
"schema": {
19470+
"schema": {
19471+
"description": "Bad Request - Invalid email address or validation error",
19472+
"type": "object",
19473+
"properties": {
19474+
"success": {
19475+
"description": "Indicates the operation failed",
19476+
"default": false,
19477+
"type": "boolean"
19478+
},
19479+
"error": {
19480+
"description": "Error message describing what went wrong",
19481+
"type": "string"
19482+
}
19483+
},
19484+
"required": [
19485+
"success",
19486+
"error"
19487+
],
19488+
"additionalProperties": false
19489+
},
19490+
"components": {}
19491+
}
19492+
}
19493+
}
19494+
},
19495+
"401": {
19496+
"description": "Default Response",
19497+
"content": {
19498+
"application/json": {
19499+
"schema": {
19500+
"schema": {
19501+
"description": "Unauthorized - Authentication required",
19502+
"type": "object",
19503+
"properties": {
19504+
"success": {
19505+
"description": "Indicates the operation failed",
19506+
"default": false,
19507+
"type": "boolean"
19508+
},
19509+
"error": {
19510+
"description": "Error message describing what went wrong",
19511+
"type": "string"
19512+
}
19513+
},
19514+
"required": [
19515+
"success",
19516+
"error"
19517+
],
19518+
"additionalProperties": false
19519+
},
19520+
"components": {}
19521+
}
19522+
}
19523+
}
19524+
},
19525+
"403": {
19526+
"description": "Default Response",
19527+
"content": {
19528+
"application/json": {
19529+
"schema": {
19530+
"schema": {
19531+
"description": "Forbidden - Insufficient permissions (requires email.test permission)",
19532+
"type": "object",
19533+
"properties": {
19534+
"success": {
19535+
"description": "Indicates the operation failed",
19536+
"default": false,
19537+
"type": "boolean"
19538+
},
19539+
"error": {
19540+
"description": "Error message describing what went wrong",
19541+
"type": "string"
19542+
}
19543+
},
19544+
"required": [
19545+
"success",
19546+
"error"
19547+
],
19548+
"additionalProperties": false
19549+
},
19550+
"components": {}
19551+
}
19552+
}
19553+
}
19554+
},
19555+
"500": {
19556+
"description": "Default Response",
19557+
"content": {
19558+
"application/json": {
19559+
"schema": {
19560+
"schema": {
19561+
"description": "Internal Server Error - SMTP configuration or email sending failed",
19562+
"type": "object",
19563+
"properties": {
19564+
"success": {
19565+
"description": "Indicates the operation failed",
19566+
"default": false,
19567+
"type": "boolean"
19568+
},
19569+
"error": {
19570+
"description": "Error message describing what went wrong",
19571+
"type": "string"
19572+
}
19573+
},
19574+
"required": [
19575+
"success",
19576+
"error"
19577+
],
19578+
"additionalProperties": false
19579+
},
19580+
"components": {}
19581+
}
19582+
}
19583+
}
19584+
}
19585+
}
19586+
}
19587+
},
1939119588
"/api/auth/email/register": {
1939219589
"post": {
1939319590
"summary": "User registration via email",

services/backend/api-spec.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13073,6 +13073,144 @@ paths:
1307313073
- error_description
1307413074
additionalProperties: false
1307513075
components: {}
13076+
/api/admin/email/test:
13077+
post:
13078+
summary: Send test email
13079+
tags:
13080+
- Admin Email
13081+
description: "Sends a test email to verify SMTP configuration. Only global
13082+
administrators can access this endpoint. Requires Content-Type:
13083+
application/json header when sending request body."
13084+
requestBody:
13085+
content:
13086+
application/json:
13087+
schema:
13088+
type: object
13089+
properties:
13090+
email:
13091+
type: string
13092+
format: email
13093+
required:
13094+
- email
13095+
additionalProperties: false
13096+
required: true
13097+
security:
13098+
- cookieAuth: []
13099+
responses:
13100+
"200":
13101+
description: Default Response
13102+
content:
13103+
application/json:
13104+
schema:
13105+
schema:
13106+
description: Test email sent successfully
13107+
type: object
13108+
properties:
13109+
success:
13110+
description: Indicates if the test email was sent successfully
13111+
type: boolean
13112+
message:
13113+
description: Success message
13114+
type: string
13115+
messageId:
13116+
description: Email message ID from SMTP server
13117+
type: string
13118+
recipients:
13119+
description: List of email recipients
13120+
type: array
13121+
items:
13122+
type: string
13123+
required:
13124+
- success
13125+
- message
13126+
- recipients
13127+
additionalProperties: false
13128+
components: {}
13129+
"400":
13130+
description: Default Response
13131+
content:
13132+
application/json:
13133+
schema:
13134+
schema:
13135+
description: Bad Request - Invalid email address or validation error
13136+
type: object
13137+
properties:
13138+
success:
13139+
description: Indicates the operation failed
13140+
default: false
13141+
type: boolean
13142+
error:
13143+
description: Error message describing what went wrong
13144+
type: string
13145+
required:
13146+
- success
13147+
- error
13148+
additionalProperties: false
13149+
components: {}
13150+
"401":
13151+
description: Default Response
13152+
content:
13153+
application/json:
13154+
schema:
13155+
schema:
13156+
description: Unauthorized - Authentication required
13157+
type: object
13158+
properties:
13159+
success:
13160+
description: Indicates the operation failed
13161+
default: false
13162+
type: boolean
13163+
error:
13164+
description: Error message describing what went wrong
13165+
type: string
13166+
required:
13167+
- success
13168+
- error
13169+
additionalProperties: false
13170+
components: {}
13171+
"403":
13172+
description: Default Response
13173+
content:
13174+
application/json:
13175+
schema:
13176+
schema:
13177+
description: Forbidden - Insufficient permissions (requires email.test
13178+
permission)
13179+
type: object
13180+
properties:
13181+
success:
13182+
description: Indicates the operation failed
13183+
default: false
13184+
type: boolean
13185+
error:
13186+
description: Error message describing what went wrong
13187+
type: string
13188+
required:
13189+
- success
13190+
- error
13191+
additionalProperties: false
13192+
components: {}
13193+
"500":
13194+
description: Default Response
13195+
content:
13196+
application/json:
13197+
schema:
13198+
schema:
13199+
description: Internal Server Error - SMTP configuration or email sending failed
13200+
type: object
13201+
properties:
13202+
success:
13203+
description: Indicates the operation failed
13204+
default: false
13205+
type: boolean
13206+
error:
13207+
description: Error message describing what went wrong
13208+
type: string
13209+
required:
13210+
- success
13211+
- error
13212+
additionalProperties: false
13213+
components: {}
1307613214
/api/auth/email/register:
1307713215
post:
1307813216
summary: User registration via email

0 commit comments

Comments
 (0)