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.

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"

AI Email Generation

Use AI to generate email content based on a prompt.

  • prompt (string, required): The prompt describing what email to generate.

Example Request

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.
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.

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.

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"

Query Parameters:
- page: Page number (default: 1)
- pageSize: Items per page (default: 10)
- folder: Filter by folder (inbox, sent, starred, etc.)
- search: Search term for subject, text, from, or to

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/: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"

Request Body (multipart/form-data):
- to (string, required): Recipient email address
- subject (string, optional): Email subject
- description (string, optional): Email body/content
- cc (string, optional): CC recipient
- attachments (file, optional): Email attachments

Contents