mailto 0.1.3
mailto: ^0.1.3 copied to clipboard
Simple Dart package for creating mailto links in your Flutter apps
mailto #
Simple Dart package for creating mailto links in your Flutter apps
This package helps you build mailto links and use those mailto links to launch the phone's email client with certain fields pre-filled, while taking care of encoding every fields properly.
The mailto package:
- supports one or many
to,cc, andbccfields - supports custom body and subject for the emails
- encodes every value for your correctly
- is blazingly fast 😜
Important links #
- Read the source code and star the repo!
- Check package info on
pub.dev - Open an issue
- Read the docs
- This Dart package is created by the SMAHO development team.
Usage #
Most likely, you want to launch the email client on the phone with certain fields pre-filled.
import 'package:mailto/mailto.dart';
// Optional, but most likely what you want
import 'package:url_launcher/url_launcher.dart';
// Somewhere in your app
launchMailto() async {
final mailtoLink = Mailto(
to: ['[email protected]'],
cc: ['[email protected]', '[email protected]'],
subject: 'mailto example subject',
body: 'mailto example body',
);
// Convert the Mailto instance into a string.
// Use either Dart's string interpolation
// or the toString() method.
await launch('$mailtoLink');
}
Use url_launcher for launching the links you create with the mailto package.
Contribute #
Tests #
We use the test package for writing and running tests.
Run the test locally by pub run test.
Format #
We use the dartfmt tool to automatically format our code in a way that follows the Dart guidelines.
Format your code by executing dartfmt -w ..