frontmail library

Send emails from Flutter and Dart apps through your Frontmail templates with the public key.

import 'package:frontmail/frontmail.dart';

final frontmail = Frontmail(publicKey: 'pk_4f2a…');
final result = await frontmail.send(templateId: 'tpl_contact', params: {'email': 'jan@example.com'});

Classes

Attachment
An email attachment: inline content (base64) or a file uploaded earlier.
DeliveryStatus
Delivery status of a message. Statuses added in newer API versions keep their raw value.
Frontmail
Frontmail API client for apps: sends emails through your templates with the public key.
FrontmailErrorCode
Error codes. Unknown codes from newer API versions are passed through as they are.
FrontmailVersion
Version of the Frontmail Dart/Flutter SDK. Keep in sync with pubspec.yaml (a test checks it).
MessageEvent
An entry of a message's event log.
MessageStatus
Response of GET /v1/messages/<id>.
PublicConfig
Response of GET /v1/public-config.
RetryPolicy
Retry policy for network errors, timeouts, 5xx and 429 responses.
SendOptions
Per-send options.
SendResult
Result of an accepted send (202).
Turnstile
Cloudflare Turnstile helpers for rendering the widget in a web view (webview_flutter).
TurnstileAllow
Let it load (the inline page, Cloudflare's challenge, about:blank / about:srcdoc).
TurnstileCancel
Cancel it.
TurnstileConfig
Frontmail's shared Turnstile widget for apps.
TurnstileError
The widget failed; code is Cloudflare's error code (or script_load_failed).
TurnstileExpired
The token expired; the widget refreshes itself. Forget any stored token.
TurnstileMessage
A validated message from the widget page, see Turnstile.parseMessage.
TurnstileNavigation
What the web view should do with a navigation request, see Turnstile.navigationAction.
TurnstileOpenExternally
Cancel it and open url in the system browser (links inside the widget).
TurnstileSite
Site key + page URL for the web view, and the turnstileKey to send tokens with.
TurnstileToken
A fresh token (single use, valid ~300 s) – pass it as SendOptions.turnstileToken.

Enums

TurnstileKey
Which Turnstile secret verifies a token sent from the app (turnstile_key).
TurnstileSize
Widget size.
TurnstileTheme
Widget theme.

Exceptions / Errors

FrontmailException
The single exception type thrown by the SDK.