flutter_mailer 0.1.1

  • README.md
  • Example
  • Installing
  • Versions
  • 87


pub package

Share an email to device Email Client - supports multiple Attachments

based off of react-native-mail

  • [x] android
  • [x] ios - work in progress.
    final MailOptions mailOptions = MailOptions(
      body: 'a long body for the email <br> with a subset of HTML',
      subject: 'the Email Subject',
      recipients: ['example@example.com'],
      isHTML: true,
      bccRecipients: ['other@example.com'],
      ccRecipients: ['third@example.com'],
      attachments: [ 'path/to/image.png', ],

    await FlutterMailer.send(mailOptions);

note gmail and other apps Might parse HTML out of the body.

Getting Started

just add it to your pubspec dependencies; like so

    sdk: flutter
  flutter_mailer: ^0.1.0

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.


  • update android dependencies


  • remove the need to edit androidManifest.xml for file sharing


  • change attachment type from List<File> to List<String>.


  • fix homepage spelling mistake in pubspec


  • add initial ios support still work in progress, i'm not a ios devepoler, its the first time i wrote objective C code


  • TODO: Describe initial release.


import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter_mailer/flutter_mailer.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  List<String> attachment = [];
  TextEditingController _subjectController = new TextEditingController(text: 'the Subject');
  TextEditingController _bodyController = new TextEditingController(text: """
  <em>the body has <code>HTML</code></em> <br><br><br>
  <strong>Some Apps like Gmail might ignore it</strong>
  final GlobalKey<ScaffoldState> _scafoldKey = new GlobalKey<ScaffoldState>();
  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> send() async {
    // Platform messages may fail, so we use a try/catch PlatformException.
    final MailOptions mailOptions = MailOptions(
      body: _bodyController.text,
      subject: _subjectController.text,
      recipients: ['example@example.com'],
      isHTML: true,
      // bccRecipients: ['other@example.com'],
      ccRecipients: ['third@example.com'],
      attachments: attachment,

    String platformResponse; 

    try {
      await FlutterMailer.send(mailOptions);
      platformResponse = 'success';
    } catch (error) {
      platformResponse = error.toString();

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;
      content: Text(platformResponse),

  Widget build(BuildContext context) {
    final Widget imagePath = Column(
        children: attachment.map((file) => Text('$file')).toList());

    return new MaterialApp(
      theme: ThemeData(primaryColor: Colors.red),
      home: new Scaffold(
        key: _scafoldKey,
        appBar: new AppBar(
          title: const Text('Plugin example app'),
          actions: <Widget>[
              onPressed: send,
              icon: Icon(Icons.send),
        body: SingleChildScrollView(
          child: new Center(
            child: Padding(
              padding: EdgeInsets.all(8.0),
              child: Column(
                mainAxisSize: MainAxisSize.max,
                // mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                    padding: const EdgeInsets.all(8.0),
                    child: TextField(
                      controller: _subjectController,
                      decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Subject',
                    padding: const EdgeInsets.all(8.0),
                    child: TextField(
                      controller: _bodyController,
                      maxLines: 10,
                      decoration: InputDecoration(
                          labelText: 'Body', border: OutlineInputBorder()),
        floatingActionButton: FloatingActionButton.extended(
          icon: Icon(Icons.camera),
          label: Text('Add Image'),
          onPressed: _picker,

  void _picker() async {
    File pick = await ImagePicker.pickImage(source: ImageSource.gallery);
    setState(() {

Use this package as a library

1. Depend on it

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

  flutter_mailer: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_mailer/flutter_mailer.dart';
Version Uploaded Documentation Archive
0.1.1 Sep 7, 2018 Go to the documentation of flutter_mailer 0.1.1 Download flutter_mailer 0.1.1 archive
0.1.0 Aug 18, 2018 Go to the documentation of flutter_mailer 0.1.0 Download flutter_mailer 0.1.0 archive
0.0.4 Jul 16, 2018 Go to the documentation of flutter_mailer 0.0.4 Download flutter_mailer 0.0.4 archive
0.0.3 Jul 15, 2018 Go to the documentation of flutter_mailer 0.0.3 Download flutter_mailer 0.0.3 archive
0.0.2 Jul 15, 2018 Go to the documentation of flutter_mailer 0.0.2 Download flutter_mailer 0.0.2 archive
0.0.1 Jul 15, 2018 Go to the documentation of flutter_mailer 0.0.1 Download flutter_mailer 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8