You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

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

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.

Parameters

ParameterTypeDescription
namestring

Example

POST /es/api/v1/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]

"Email sent successfully"

Validation Error [422]

{
  "detail": [
    {
      "loc": ["body", "to_email"],
      "msg": "Field required",
      "type": "value_error.missing"
    }
  ]
}
  • No labels