mandrill 1.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 75

Mandrill API #

This is a native dart implementation of a Mandrill API client.

It's not a fork of the other mandrill_api package, because the other library is quite old, unmaintained and not very suitable to be ported to Dart 2.0

Usage #

import 'package:mandrill/mandrill_server.dart';
// or if you're in the browser:
// import 'package:mandrill/mandrill_browser.dart';

final apiKey = 'your-key';

main() async {
  final mandrill = createMandrill(apiKey);

  final recipients = [
    new Recipient(email: 'customer1@example.com', name: 'Customer 1'),
    new Recipient(email: 'customer2@example.com', name: 'Customer 2', type: RecipientType.bcc),
  ];

  final message = new OutgoingMessage(
    html: '<h1>Welcome to our website</h1>',
    text: 'WELCOME TO OUR WEBSITE',
    to: recipients,
    /* etc... */
  );

  final response = await mandrill.messages.send(message);
}

For a full example, please see example/example.dart.

Stability #

This library is meant to be rock solid, using Codable to (de)serialize JSON messages, well tested and used in production.

Completeness #

We have only implemented a subset of the full API calls, because we don't need the other calls right now.

To see which API calls have been implemented, please check the API Documentation.

If you need other resources to be implemented we are happy to accept Merge Requests, but we are also willing to add new resources if requested.

License #

MIT

Changelog #

1.1.2 #

  • Upgrade dependencies.

1.1.1 #

  • Make Recipient.name optional.

1.1.0 #

  • Expose package:mandrill/mandrill.dart in package:mandrill/mandrill_server.dart so users of this library don't need to import both files.

1.0.1 #

  • Add analysis_options.yaml and fix all errors, warnings and hints.

1.0.0 #

  • Initial release of the library

example/example.dart

import 'package:logging/logging.dart';
import 'package:mandrill/mandrill_server.dart';

const apiKey = 'your-key';

void main() async {
  Logger.root
    ..level = Level.ALL
    ..onRecord.listen(print);

  final log = new Logger('Mandrill Example');

  final mandrill = createMandrill(apiKey);

  final recipients = [
    new Recipient(email: 'customer1@example.com', name: 'Customer 1'),
    new Recipient(
        email: 'customer2@example.com',
        name: 'Customer 2',
        type: RecipientType.bcc),
  ];

  final message = new OutgoingMessage(
    html: '<h1>Welcome to our website</h1>',
    text: 'WELCOME TO OUR WEBSITE',
    fromEmail: 'good@website.com',
    fromName: 'Greatest Website',
    to: recipients,
    important: true,
  );

  try {
    final response = await mandrill.messages.send(message);
    log.info('${response.sentMessages.length} messages have been sent.');
  } on MandrillException catch (e) {
    log.severe(e.toString());
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  mandrill: ^1.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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:mandrill/mandrill.dart';
  
Version Uploaded Documentation Archive
1.1.2 Mar 27, 2019 Go to the documentation of mandrill 1.1.2 Download mandrill 1.1.2 archive
1.1.1 Aug 9, 2018 Go to the documentation of mandrill 1.1.1 Download mandrill 1.1.1 archive
1.1.0 Aug 9, 2018 Go to the documentation of mandrill 1.1.0 Download mandrill 1.1.0 archive
1.0.1 Aug 7, 2018 Go to the documentation of mandrill 1.0.1 Download mandrill 1.0.1 archive
1.0.0 Aug 6, 2018 Go to the documentation of mandrill 1.0.0 Download mandrill 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
96
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 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:mandrill/mandrill.dart.

Health suggestions

Fix lib/client/client.dart. (-2.48 points)

Analysis of lib/client/client.dart reported 5 hints:

line 18 col 16: Use = to separate a named parameter from its default value.

line 19 col 14: Use = to separate a named parameter from its default value.

line 20 col 14: Use = to separate a named parameter from its default value.

line 21 col 20: Use = to separate a named parameter from its default value.

line 22 col 17: Use = to separate a named parameter from its default value.

Fix lib/src/resources/messages.dart. (-1 points)

Analysis of lib/src/resources/messages.dart reported 2 hints:

line 27 col 19: Use = to separate a named parameter from its default value.

line 54 col 19: Use = to separate a named parameter from its default value.

Fix lib/src/messages/messages.dart. (-0.50 points)

Analysis of lib/src/messages/messages.dart reported 1 hint:

line 25 col 14: Use = to separate a named parameter from its default value.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
codable ^1.0.0 1.0.0
http >=0.11.0 <0.13.0 0.12.0+2
intl ^0.15.0 0.15.8
logging ^0.11.0 0.11.3+2
meta ^1.1.6 1.1.7
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
path 1.6.2
pedantic 1.5.0
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
grind_publish ^0.0.5
grinder ^0.8.3
mockito ^4.0.0
test ^1.3.0