This endpoint allows you to test sending emails using different predefined templates. It’s particularly useful for verifying email rendering and ensuring variables are correctly replaced.
Authentication
This endpoint doesn’t require authentication but is intended for development and testing purposes only.
Query Parameters
The email address to which the test email will be sent
The template to use for the email. Possible values: login
, welcome
, setup
, feedback
The user’s first name to insert in the template
Response
Indicates whether the email was sent successfully
Status message regarding the email sending
200 OK
{
"success": true,
"message": "Test email successfully sent to your_email@example.com"
}
400 Bad Request
{
"success": false,
"message": "Missing parameters",
"errors": [
"email is required",
"template is required"
]
}
404 Not Found
{
"success": false,
"message": "Template not found",
"error": "The template 'invalid-template' does not exist"
}
Available Template Types
Login
Login email, typically sent when a user logs into their account or requests a passwordless login link.
# Testing login email template
GET http://localhost:3000/api/marketing/test-email-simple?email=user@example.com&template=login&firstName=John
Welcome
Welcome email, sent to new users upon registration.
# Testing welcome email template
GET http://localhost:3000/api/marketing/test-email-simple?email=user@example.com&template=welcome&firstName=John
Setup
Account setup email, sent to guide users through the initial configuration of their account.
# Testing setup email template
GET http://localhost:3000/api/marketing/test-email-simple?email=user@example.com&template=setup&firstName=John
Feedback
Feedback request email, sent to solicit user feedback on the service.
# Testing feedback email template
GET http://localhost:3000/api/marketing/test-email-simple?email=user@example.com&template=feedback&firstName=John
Example Usage
// Example: Test various email templates
// Testing login template
const testLoginEmail = async () => {
const response = await fetch('http://localhost:3000/api/marketing/test-email-simple?email=jopad.pro1@gmail.com&template=login&firstName=jopad', {
method: 'GET'
});
const data = await response.json();
console.log(data);
};
// Testing welcome template
const testWelcomeEmail = async () => {
const response = await fetch('http://localhost:3000/api/marketing/test-email-simple?email=jopad.pro1@gmail.com&template=welcome&firstName=jopad', {
method: 'GET'
});
const data = await response.json();
console.log(data);
};
// Testing setup template
const testSetupEmail = async () => {
const response = await fetch('http://localhost:3000/api/marketing/test-email-simple?email=jopad.pro1@gmail.com&template=setup&firstName=jopad', {
method: 'GET'
});
const data = await response.json();
console.log(data);
};
// Testing feedback template
const testFeedbackEmail = async () => {
const response = await fetch('http://localhost:3000/api/marketing/test-email-simple?email=jopad.pro1@gmail.com&template=feedback&firstName=jopad', {
method: 'GET'
});
const data = await response.json();
console.log(data);
};
Implementation Notes
- This endpoint is intended for development and testing environments
- In production, this endpoint may be disabled or restricted
- Use actual email addresses for testing as these are real emails being sent
- The email templates used are the same ones used in production
The email address to send the test to
The template to use for the email
Available options:
login
,
welcome
,
setup
,
feedback
The user's first name to insert in the template
Example:"Test email successfully sent to your_email@example.com"