mailto 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

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, and bcc fields
  • supports custom body and subject for the emails
  • encodes every value for your correctly
  • is blazingly fast 😜

smaho-engineering/mailto

Build Status Code coverage

mailto GitHub Stars Count

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: ['to@example.com'],
    cc: ['cc1@example.com', 'cc2@example.com'],
    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.

The package currently does not follow RFC 6068 - The 'mailto' URI Scheme, but it's planned to make sure that the package works well on all platforms and with all email clients.

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 ..

0.1.4 #

Improve README

0.1.3 #

Write README and Flutter example app

0.1.2 #

Add the meta package as dependency

0.1.1 #

Add changelog and example command-line script

0.1.0 #

Initial version of the mailto package

example/README.md

mailto examples #

You can read the examples' source code on GitHub.

Command line #

cd example/command_line
dart mailto_example.dart

Flutter #

Not available yet.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mailto: ^0.1.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mailto/mailto.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
meta ^1.1.8 1.1.8
Dev dependencies
test ^1.9.4