Skip to main content

Email API

POST /api/email

Send an email on behalf of a client (admin only).

Headers:

  • AdminToken: <adminToken> (required)
  • Content-Type: application/json

Request Body:

{
"toList": ["user1@example.com"],
"ccList": ["manager@example.com", "admin@example.com"],
"fromName": "Sample Sender",
"fromEmail": "sender@example.com",
"subject": "Testing GOFA Email API",
"htmlContent": "<html>...your HTML content...</html>"
}

Response:

  • 200 OK: { "message": "Email sent successfully" }
  • 400 Bad Request: { "error": "string" }
  • 500 Internal Server Error: { "error": "string" }

AttachmentJSON Structure

export interface AttachmentJSON {
content: string; // Base64-encoded file content (required)
filename: string; // Name of the attachment (required)
type?: string; // MIME type (optional)
disposition?: string; // Content disposition (optional)
content_id?: string; // Content ID for inline attachments (optional)
}
note

Only accessible to GOFA super admin users.

All email addresses are validated. If any address is invalid, the request fails with a 400 error.

Attachments must include filename and content (base64). type, disposition, and content_id are optional.

There may be limits on the number of recipients and attachment size (see implementation).

The API expects valid HTML in htmlContent.