Documentation

SDKs / pub.dev

Flutter / Dart email API SDK

Pure Dart SDK for Flutter apps and Dart backends. Dart 3.4 or newer.

Server-side SDK. This is a server-side SDK. The send API uses secret keys (ms_live_…) that must never ship inside a Flutter app bundle. In a mobile or web Flutter client, call your own backend and have that backend use this SDK.

Install

dart pub add mailstack

pub.dev package ↗ Source on GitHub ↗

Quickstart

Send your first email — create an API key in the dashboard, then:

import 'package:mailstack/mailstack.dart';

Future<void> main() async {
  final ms = MailStackClient(apiKey: 'ms_live_xxxxxxxxxxxx');

  final res = await ms.emails.send(const SendEmailRequest(
    from: 'hello@yourdomain.com',
    to: 'user@example.com',
    subject: 'Welcome to MailStack',
    html: '<h1>Hi there 👋</h1>',
  ));

  print('${res.id} ${res.status}');
  ms.close();
}

The send API is authenticated with your ms_live_ key. For dashboard resources (domains, templates, webhooks) pass your organization id too — see the REST API reference.

Verifying webhooks

Verify incoming webhook deliveries against the raw request body. The signature is an HMAC-SHA256 over {timestamp}.{body} carried in the MailStack-Signature header:

import 'package:mailstack/mailstack.dart';

final ok = verifyWebhookSignature(
  secret: webhookSecret,
  payload: rawBody, // RAW request body string
  signature: request.headers.value(webhookSignatureHeader) ?? '',
);

What's included

  • Pure Dart — Flutter and server-side Dart
  • Single, batch, bulk, scheduled, and lint sends
  • Messages, domains, templates, API keys, webhooks
  • Integer-encoded enums with .fromInt / .value
  • Webhook signature verification helper

Next steps

Browse the full REST API reference, read the quickstart, or compare the other official SDKs.