emailitSend (common/send.ts)

activepieces · packages/pieces/community/emailit/src/lib/common/send.ts · typescript · MIT
email, tag:knn-classified

Builds email payloads and sends emails through Emailit, handling attachments and validation.

// Source: https://github.com/activepieces/activepieces | License: MIT | Copyright 2020-2024 Activepieces Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { HttpMethod } from '@activepieces/pieces-common';
import { EmailitAuthInput, emailitClient } from './client';
import { emailitValues } from './values';

function buildBody(input: SendInput): Record<string, unknown> {
  const template = emailitValues.optionalText(input.template);
  const subject = emailitValues.singleLine({ value: input.subject, label: 'Subject' });
  const html = nonBlank(input.html);
  const text = nonBlank(input.text);
  if (subject === undefined && template === undefined) {
    throw new Error('Subject is required unless you send a template.');
  }
  if (html === undefined && text === undef

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key