Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If configure, mailer allows to send emails through an Mail Server, its configuration can be found on the config.py file.

Warning

Only available when mailer is set


The mail body request is represented by the following model

PropertyDescriptionDefaultTypeRequired
from_emailFrom to display in the email[email protected]stringNo
to_emailTest destination for all email send-stringYes
subjectSubject, if none is defined in configurationEmail SubjectstringNo
data_urlURL to be added to the messagehttp://example.com/stringNo
usernameUsername used in the mail body-stringYes
Tip

The body of the mail can be modified here models/api/mailer.py

Send Email

Use this endpoint to send an email through the Mail Server. It requires authentication and expects a JSON request body with specific parameters.

Route Name

Parameters

ParameterTypeDescriptionnamestring

Table of Contents
maxLevel2

Example

Code Block
languagebash
GET /es/api/v1/<rest of the route>

Response

Successful Response [200]

Code Block

Validation Error [422]

Code BlockRoute Name

Parameters

ParameterTypeDescription
namestring

Table of Contents
maxLevel2

Example

Code Block
languagebash
GETPOST /es/api/v1/<rest of the route>/mailer/send
Content-Type: application/json

{
  "from_email": "[email protected]",
  "to_email": "[email protected]",
  "subject": "Hello",
  "data_url": "http://example.com/",
  "username": "John"
}

Response

Successful Response [200]

Code Block
"Email sent successfully"

Validation Error [422]

Code Block
{
  "detail": [
    {
      "loc": ["body", "to_email"],
      "msg": "Field required",
      "type": "value_error.missing"
    }
  ]
}