You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 4
Next »
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"
}
]
}
If you intend to use Gmail as the SMTP server for this mailer, be sure to have the email (and Google) account ready for it.
Because if you configure the Mailer section with an email and it's correct password, this issue is going to appear:
This is because Google enforces the usage of Application passwords when allowing access to an account instead of the Account Password.
To enable this Application password you need to follow these steps:
- Enable the Two-Factor Authentication (if not enabled).
- Go to Security settings in your account.
- On the Section "Signing in to Google" there is the option to enable the 2-step authentication.
- Follow the steps and enable the authentication.
- Create an Application Password.
- Go to the Application Passwords section.
- Generate a new "Other (Custom name)" password.
- Enter a name for the new app password.
- Click on "Generate"
- This will generate a 16 characters password that is the one you need to use in the SAPI configuration file.
- NOTE: This password is only shown once, so, save it somewhere safe!
- Add the new application password to the configuration of SearchAPI.