Skip to content
pubscout

mailto

2.0.0, released 6 years ago by smaho.dev

Create mailto URIs with support for multiple to, cc, bcc, subject, and body fields with encoding.

WASM-ready
$ flutter pub add mailto
Source repository

What it does

The mailto package helps build mailto links by providing a Dart interface for setting to, cc, bcc, subject, and body fields, while correctly encoding values. It is typically combined with a package like url_launcher to open the email client.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to let users open their email client with pre-filled fields to contact support or send feedback
  • You need to correctly encode mailto URI parameters according to the RFC 6068 standard

Skip it when

  • You need a bullet-proof, consistent email-sending mechanism across all devices and web clients
  • You need to handle extremely long mailto links exceeding 1000 characters

Strengths

  • Supports multiple to, cc, and bcc fields
  • Handles URL encoding of special characters automatically
  • Includes validation parameters function

Weaknesses

  • Mailto link behavior is inconsistent across different email clients and web browsers
  • May fail if the resulting link is extremely long

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

not documented

final mailtoLink = Mailto(
  to: ['to@example.com'],
  cc: ['cc1@example.com', 'cc2@example.com'],
  subject: 'mailto example subject',
  body: 'mailto example body',
);
await launch('$mailtoLink');

Alternatives

Packages that do the same job and could replace mailto.