Skip to main content
Glama
getplatform

GetMailer MCP Server

by getplatform

send_email

Send transactional emails through GetMailer MCP Server. Deliver automated messages to recipients with HTML or text content, CC/BCC options, and template support.

Instructions

Send a transactional email via GetMailer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSender email address (must be from a verified domain)
toYesRecipient email address(es)
subjectYesEmail subject line
htmlNoHTML content of the email
textNoPlain text content of the email
ccNoCC recipients (optional)
bccNoBCC recipients (optional)
replyToNoReply-to address (optional)
templateIdNoTemplate ID to use instead of html/text (optional)
variablesNoTemplate variables as key-value pairs (optional)

Implementation Reference

  • Handler for the 'send_email' tool: Posts the input arguments to the GetMailer API /api/emails endpoint using the apiRequest helper and returns the JSON result as text content.
    case 'send_email': {
      const result = await apiRequest<{ email: unknown; suppressed?: string[] }>(
        '/api/emails',
        {
          method: 'POST',
          body: JSON.stringify(args),
        }
      );
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:66-118 (registration)
    Registration of the 'send_email' tool in the ListToolsRequestHandler, including name, description, and detailed input schema.
    {
      name: 'send_email',
      description: 'Send a transactional email via GetMailer',
      inputSchema: {
        type: 'object' as const,
        properties: {
          from: {
            type: 'string',
            description: 'Sender email address (must be from a verified domain)',
          },
          to: {
            type: 'array',
            items: { type: 'string' },
            description: 'Recipient email address(es)',
          },
          subject: {
            type: 'string',
            description: 'Email subject line',
          },
          html: {
            type: 'string',
            description: 'HTML content of the email',
          },
          text: {
            type: 'string',
            description: 'Plain text content of the email',
          },
          cc: {
            type: 'array',
            items: { type: 'string' },
            description: 'CC recipients (optional)',
          },
          bcc: {
            type: 'array',
            items: { type: 'string' },
            description: 'BCC recipients (optional)',
          },
          replyTo: {
            type: 'string',
            description: 'Reply-to address (optional)',
          },
          templateId: {
            type: 'string',
            description: 'Template ID to use instead of html/text (optional)',
          },
          variables: {
            type: 'object',
            description: 'Template variables as key-value pairs (optional)',
          },
        },
        required: ['from', 'to', 'subject'],
      },
    },
  • Shared helper function apiRequest used by the send_email handler (and others) to make authenticated HTTP requests to the GetMailer API.
    async function apiRequest<T>(
      endpoint: string,
      options: RequestInit = {}
    ): Promise<T> {
      const url = `${API_URL}${endpoint}`;
    
      const response = await fetch(url, {
        ...options,
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Bearer ${API_KEY}`,
          ...options.headers,
        },
      });
    
      if (!response.ok) {
        let errorMessage = response.statusText;
        try {
          const errorData = await response.json();
          errorMessage = errorData.error || errorData.message || errorMessage;
        } catch {
          // Ignore
        }
        throw new Error(`API Error: ${errorMessage}`);
      }
    
      return response.json();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/getplatform/getmailer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server