Using Sandbox mode to send an email
Testing your Transactional email in a Sandbox environment
Pre-requisites
You can utilize a Sandbox environment to test unsafe or untested programs and features without affecting the application or the platform. For sending a Transactional email in Sandbox, you can include another header which is mentioned below.
"headers": {"X-Sib-Sandbox":"drop"}
How does it work?
You can use a drop flag as mentioned above to run the transactional email in a testing environment. What it basically does is, it does not change the platform in any way rather it tells the user if the API endpoint is running smoothly or not in a safe environment. As shown below in a request, the header has been included.
curl --request POST \
--url https://api.brevo.com/v3/smtp/email \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
{
"sender": {
"name": "Obaidullah",
"email": "[email protected]"
},
"headers": {
"X-Sib-Sandbox": "drop"
},
"to": [
{
"email": "[email protected]",
"name": "Obaid"
}
],
"htmlContent": "<!DOCTYPE html> <html> <body> <h1>Confirm you email</h1> <p>Please confirm your email address by clicking on the link below</p> </body> </html>",
"textContent": "Please confirm your email address by clicking on the link https://text.domain.com",
"subject": "Login Email confirmation"
}
'
The response you will get
The recipient will not receive any email nor there would be any logs for this email in the Brevo account. After sending the request, you will receive a success response in your JSON response. A sample 201
response is displayed below.
{
"messageId": "<[email protected]>"
}
Updated 11 months ago