imap_client 0.1.2

  • Example
  • Installing
  • Versions
  • new50


An interface to get emails via the imap protocol (version 4rev1)

This interface implements the IMAP protocol (version 4 rev 1) as described in rfc 3501. This package gives an easy access to all commands and automatically analyzes responses. All responses are accessible through an ImapResponse object.

Supported extensions:

  • RFC 2177: IMAP4 IDLE command

This package is made available under the GNU General Public License v3.0.


This example connects the client to an imap server:

import 'package:imap_client/imap_client.dart';

main() async {
  ImapClient client = new ImapClient();
  await client.connect("", 993, true).then((response) {

All commands are async methods that can be awaited for. On completion, they return an ImapResponse object, which holds all data that was returned by the server until command completion. It also holds the command completion status:

  • OK: success
  • NO: command was unsuccessful
  • BAD: command not accepted by the server

Update responses are handled as soon as they arrive and don't show up in the ImapResponse. To get EXISTS responses, you must supply a handler function, that takes care of it. Other update responses are: EXPUNGE, RECENT, FETCH and ALERT. Handlers can be set by setting the client's typeHandler attributes.

Example for EXISTS:

client.existsHandler = (String mailboxName, int messageNumber) { ... }

Features and bugs

Please file feature requests and bugs at the issue tracker.


  • Implement logging. Use printImapClientDebugLog() to display it.


  • Fix errors caused by older dart version 2.0.0-dev.63.0
  • Set minimum required sdk version to 2.0.0-dev.63.0


  • Initial version


import "package:imap_client/imap_client.dart";

main() async {
  ImapClient client = new ImapClient();

  await client.connect("", 993, true).then((response) {
  await client.capability().then((response) {
  await client.noop();
  await client
      .authenticate("example@gmailcom", "verysecurepassword")
      .then((response) {
    print(response.status); // NO, because credentials are invalid
  await client.logout().then((response) {

Use this package as a library

1. Depend on it

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

  imap_client: ^0.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:imap_client/imap_client.dart';
Version Uploaded Documentation Archive
0.1.2 Jul 14, 2018 Go to the documentation of imap_client 0.1.2 Download imap_client 0.1.2 archive
0.1.1 Jul 14, 2018 Go to the documentation of imap_client 0.1.1 Download imap_client 0.1.1 archive
0.1.0 Jul 13, 2018 Go to the documentation of imap_client 0.1.0 Download imap_client 0.1.0 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 Jul 17, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.66.0
  • pana: 0.11.7


Detected platforms: Flutter, other

Primary library: package:imap_client/imap_client.dart with components: io.


Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.63.0 <3.0.0
logging ^0.11.3 0.11.3+1
Dev dependencies
test ^0.12.30