Email Sandbox API
The Email Sandbox API allows you to verify domains, add SMTP credentials, and send emails directly from your project. Below is a detailed guide to each endpoint and how to use it.
Endpoints Overview
- POST /smtp: Add a domain to your project.
- GET /smtp/find: Retrieve DNS records to verify the domain.
- DELETE /smtp/:id: Delete a domain from your project.
- POST /smtp/:id/smtp: Add new SMTP credentials for the domain.
- DELETE /smtp/:username: Delete SMTP credentials.
- POST /smtp/:email: Send an email using the SMTP credentials.
Add a Domain
Use this endpoint to add a domain to your project. After adding, you`ll receive DNS records for verification.
- domain (string, required): A valid domain name to add to the project.
Example Request
curl -X POST "https://api.meetandrock.com/v1/dev/smtp" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com" }'
Retrieve DNS Records
Use this endpoint to get the DNS records required to verify your domain. Add these records to your DNS configuration.
curl -X GET "https://api.meetandrock.com/v1/dev/smtp/find" \ -H "Authorization: Bearer YOUR_API_KEY"
Add SMTP Credentials
Once your domain is verified, use this endpoint to create SMTP credentials for sending emails.
- username (string, required): The username for the SMTP credential.
- password (string, required): The password for the SMTP credential.
curl -X POST "https://api.meetandrock.com/v1/dev/smtp/:id/smtp" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "username": "user@example.com", "password": "securepassword" }'
Send an Email
Use this endpoint to send an email using the created SMTP credentials.
- to (string, required): The recipient`s email address.
- email (string, required): The SMTP username.
- password (string, required): The SMTP password.
- cc (array, optional): CC recipients.
- subject (string, optional): Email subject.
- description (string, optional): Email body.
curl -X POST "https://api.meetandrock.com/v1/dev/smtp/:email" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "recipient@example.com", "email": "user@example.com", "password": "securepassword", "subject": "Hello!", "description": "This is a test email." }'