Skip to content

Commit cb0056a

Browse files
committed
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)
1 parent 7ef0523 commit cb0056a

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

data/web/api/openapi.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6058,36 +6058,37 @@ paths:
60586058
examples:
60596059
response:
60606060
value:
6061-
- type: success
6061+
- log:
6062+
- smtp_api
6063+
- send
6064+
- from: sender@domain.tld
6065+
to:
6066+
- recipient@domain.tld
6067+
subject: Test Subject
6068+
body: "***"
6069+
password: "*"
60626070
msg:
60636071
- smtp_mail_sent
60646072
- sender@domain.tld
60656073
- recipient@domain.tld
6074+
type: success
60666075
schema:
60676076
properties:
6077+
log:
6078+
description: contains request object
6079+
items: {}
6080+
type: array
6081+
msg:
6082+
items: {}
6083+
type: array
60686084
type:
60696085
enum:
60706086
- success
6087+
- danger
60716088
- error
60726089
type: string
6073-
msg:
6074-
items: {}
6075-
type: array
60766090
type: object
60776091
description: OK
6078-
"400":
6079-
content:
6080-
application/json:
6081-
schema:
6082-
properties:
6083-
type:
6084-
type: string
6085-
example: error
6086-
msg:
6087-
type: array
6088-
items: {}
6089-
type: object
6090-
description: Bad Request - Validation error or SMTP failure
60916092
tags:
60926093
- SMTP
60936094
description: >-
@@ -6099,9 +6100,8 @@ paths:
60996100
**Authentication**: Requires a read-write API key.
61006101
61016102
6102-
**Note**: When using authenticated SMTP (port 587 with STARTTLS or port 465 with SSL),
6103-
provide the password field. For unauthenticated internal sending (port 25),
6104-
the password can be omitted.
6103+
**Note**: SMTP authentication with mailbox credentials is required.
6104+
Use port 587 for STARTTLS or port 465 for SSL/TLS.
61056105
operationId: Send email
61066106
requestBody:
61076107
content:

data/web/json_api.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,6 @@ function process_send_return($return) {
20372037
'msg' => 'Email sent successfully'
20382038
));
20392039
if ($return === false) {
2040-
http_response_code(400);
20412040
echo isset($_SESSION['return']) ? json_encode($_SESSION['return']) : $generic_failure;
20422041
}
20432042
else {

0 commit comments

Comments
 (0)