Skip to main content

frontmail 0.1.0 copy "frontmail: ^0.1.0" to clipboard
frontmail: ^0.1.0 copied to clipboard

Send emails from Flutter and Dart apps through your Frontmail templates with the public key – retries with idempotency, delivery status and Cloudflare Turnstile helpers.

example/main.dart

// Sends one email from the command line:
//   dart run example/main.dart pk_… tpl_… you@example.com
// In a Flutter app the calls are the same – see the README for a form with Turnstile.
import 'package:frontmail/frontmail.dart';

Future<void> main(List<String> args) async {
  if (args.length < 3) {
    print('usage: dart run example/main.dart <public key> <template id> <email>');
    return;
  }
  final frontmail = Frontmail(publicKey: args[0]);
  try {
    final result = await frontmail.send(
      templateId: args[1],
      params: {'email': args[2], 'message': 'Hello from Dart!'},
    );
    print(result.status == DeliveryStatus.held
        ? 'Received – it will be delivered shortly.'
        : 'Sent ${result.messageId}');

    final status = await frontmail.status(messageId: result.messageId, statusToken: result.statusToken);
    print('Status: ${status.status} (${status.events.map((e) => e.type).join(', ')})');
  } on FrontmailException catch (e) {
    print('${e.code}: ${e.message} – ${e.docsUrl}');
  } finally {
    frontmail.close();
  }
}
0
likes
160
points
71
downloads

Documentation

Documentation
API reference

Publisher

verified publisherfrontmail.dev

Weekly Downloads

Send emails from Flutter and Dart apps through your Frontmail templates with the public key – retries with idempotency, delivery status and Cloudflare Turnstile helpers.

Homepage
Repository (GitHub)
View/report issues

Topics

#email #form #turnstile #api-client

License

MIT (license)

Dependencies

http, http_parser

More

Packages that depend on frontmail