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/email-generate: Generate email content using AI.
- POST/smtp/:id/smtp: Add new SMTP credentials for the domain.
- DELETE/smtp/:emailCredentialId: Delete SMTP credentials.
- GET/smtp/:emailCredentialId/list: Get list of emails for SMTP credential.
- POST/smtp/:emailCredentialId/send: 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.
Register a new sending domain for your project.
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.
Fetch DNS records needed to verify your sending domain.
curl -X GET "https://api.meetandrock.com/v1/dev/smtp/find" \ -H "Authorization: Bearer YOUR_API_KEY"AI Email Generation
Use AI to generate email content based on a prompt.
- prompt (string, required): The prompt describing what email to generate.
Use AI to generate a ready-to-send email from a natural language prompt.
curl -X POST "https://api.meetandrock.com/v1/dev/smtp/email-generate" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Write a professional email to follow up on a meeting" }'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.
Attach SMTP login details to a verified domain.
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" }'Delete SMTP Credentials
Delete SMTP credentials for a domain.
Remove previously created SMTP credentials.
curl -X DELETE "https://api.meetandrock.com/v1/dev/smtp/:emailCredentialId" \ -H "Authorization: Bearer YOUR_API_KEY"Get Email List
Retrieve the list of emails for a specific SMTP credential with optional filtering.
List emails for a given SMTP credential, with optional pagination and filtering.
curl -X GET "https://api.meetandrock.com/v1/dev/smtp/:emailCredentialId/list?page=1&pageSize=10&folder=inbox&search=subject" \ -H "Authorization: Bearer YOUR_API_KEY"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.
Send an email using stored SMTP credentials, including optional CC and attachments.
curl -X POST "https://api.meetandrock.com/v1/dev/smtp/:emailCredentialId/send" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "to=recipient@example.com" \ -F "subject=Hello!" \ -F "description=This is a test email." \ -F "cc=cc@example.com" \ -F "attachments=@/path/to/file.pdf"