fix: align SMTP API with existing response patterns

- Remove 400 response (use 200 with error type like other endpoints)
- Add 'danger' to type enum for consistency
- Add 'log' field to response schema
- Update description (auth required)
This commit is contained in:
Mohammad Reza Tayyebi (on Dell Latitude) 2026-01-01 19:22:07 +04:00
parent 7ef052326e
commit cb0056acc5
No known key found for this signature in database
2 changed files with 20 additions and 21 deletions

View file

@ -6058,36 +6058,37 @@ paths:
examples:
response:
value:
- type: success
- log:
- smtp_api
- send
- from: sender@domain.tld
to:
- recipient@domain.tld
subject: Test Subject
body: "***"
password: "*"
msg:
- smtp_mail_sent
- sender@domain.tld
- recipient@domain.tld
type: success
schema:
properties:
log:
description: contains request object
items: {}
type: array
msg:
items: {}
type: array
type:
enum:
- success
- danger
- error
type: string
msg:
items: {}
type: array
type: object
description: OK
"400":
content:
application/json:
schema:
properties:
type:
type: string
example: error
msg:
type: array
items: {}
type: object
description: Bad Request - Validation error or SMTP failure
tags:
- SMTP
description: >-
@ -6099,9 +6100,8 @@ paths:
**Authentication**: Requires a read-write API key.
**Note**: When using authenticated SMTP (port 587 with STARTTLS or port 465 with SSL),
provide the password field. For unauthenticated internal sending (port 25),
the password can be omitted.
**Note**: SMTP authentication with mailbox credentials is required.
Use port 587 for STARTTLS or port 465 for SSL/TLS.
operationId: Send email
requestBody:
content:

View file

@ -2037,7 +2037,6 @@ if (isset($_GET['query'])) {
'msg' => 'Email sent successfully'
));
if ($return === false) {
http_response_code(400);
echo isset($_SESSION['return']) ? json_encode($_SESSION['return']) : $generic_failure;
}
else {