mailer 0.8.10

  • Installing
  • Versions
  • --


Mailer is an easy to use library for composing and sending emails in Dart.

Mailer supports file attachments, HTML emails and multiple transport methods.


  • Plaintext and HTML emails
  • Unicode support
  • Attachments
  • Secure (filters and sanitizes all fields context-wise)
  • Use any SMTP server like Gmail, Live, SendGrid, Amazon SES
  • SSL/TLS support
  • Pre-configured services (Gmail, Live,, etc.). Just fill in your username and password.


  • All possible SMTP authentication methods (now just LOGIN)
  • Sendmail
  • Stream attachments
  • String-based attachments


Sending an email with SMTP

In this example we send an email using a Gmail account.

import 'package:mailer/mailer.dart';

main() {
  // If you want to use an arbitrary SMTP server, go with `new SmtpOptions()`.
  // This class below is just for convenience. There are more similar classes available.
  var options = new GmailSmtpOptions()
    ..username = 'your gmail username'
    ..password = 'your gmail password'; // Note: if you have Google's "app specific passwords" enabled,
                                        // you need to use one of those here.

  // Create our email transport.
  var emailTransport = new SmtpTransport(options);

  // Create our mail/envelope.
  var envelope = new Envelope()
    ..from = ''
    ..subject = 'Testing the Dart Mailer library 語'
    ..attachments.add(new Attachment(file: new File('path/to/file')))
    ..text = 'This is a cool email message. Whats up? 語'
    ..html = '<h1>Test</h1><p>Hey!</p>';

  // Email it.
    .then((success) => print('Email sent! $success'))
    .catchError((e) => print('Error occured: $e'));


This library is licensed under MIT.

Use this package as a library

1. Depend on it

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

  mailer: ^0.8.10

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:mailer/mailer.dart';
Version Uploaded Documentation Archive
2.0.2 Oct 8, 2018 Go to the documentation of mailer 2.0.2 Download mailer 2.0.2 archive
2.0.1 Sep 24, 2018 Go to the documentation of mailer 2.0.1 Download mailer 2.0.1 archive
2.0.0 Sep 20, 2018 Go to the documentation of mailer 2.0.0 Download mailer 2.0.0 archive
1.2.3 Aug 20, 2018 Go to the documentation of mailer 1.2.3 Download mailer 1.2.3 archive
1.2.2 Aug 19, 2018 Go to the documentation of mailer 1.2.2 Download mailer 1.2.2 archive
1.2.1 Aug 17, 2018 Go to the documentation of mailer 1.2.1 Download mailer 1.2.1 archive
1.2.0 Aug 17, 2018 Go to the documentation of mailer 1.2.0 Download mailer 1.2.0 archive
1.1.4 May 26, 2017 Go to the documentation of mailer 1.1.4 Download mailer 1.1.4 archive
1.1.3 May 24, 2017 Go to the documentation of mailer 1.1.3 Download mailer 1.1.3 archive
1.1.2 May 23, 2017 Go to the documentation of mailer 1.1.2 Download mailer 1.1.2 archive

All 25 versions...

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.

This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.8.10+6 <2.0.0