Mail

1 min read

A global mail.send method is available to send mail using an external SMTP server. Flowlet does not provide an SMTP server, but you may use use external services like Mailjet, Mailgun, Sendinblue, or Sendgrid.

send: (
  server: string,
  from: string,
  to: string,
  subject: string,
  body: string,
  isHtml: boolean,
  options?: {
    cc?: string;
    bcc?: string;
    attachments?: {
      filename: string;
      content: string;
      contentDisposition?: 'inline' | 'attachment';
      cid?: string;
    }[];
    replyTo?: string;
    inReplyTo?: string;
    messageId?: string;
  }
) => Promise<void>;

When sending attachments, you must provide the contents as a base64 encoded string.

The incoming mail flow type lets you receive mail for processing in flows. These mails may contain attachments, but their body is not included directly in the flow data. However, you can get the attachment body using the message id.

readAttachment: (messageId: string, filename: string) => Promise<Buffer>;