imap_client 0.1.3

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

imap_client

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.

Usage

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("imap.gmail.com", 993, true).then((response) {
    print(response.fullResponse);
  });
}

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.

0.1.3

  • Update test package to latest version
  • Do travis tests on stable, now that dart v2 is out of dev

0.1.2

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

0.1.1

  • 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

0.1.0

  • Initial version

example/imap_client_example.dart

import "package:imap_client/imap_client.dart";

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

  await client.connect("imap.gmail.com", 993, true).then((response) {
    print(response.fullResponse);
  });
  await client.capability().then((response) {
    print(response.untagged['CAPABILITY']);
  });
  await client.noop();
  await client
      .authenticate("example@gmailcom", "verysecurepassword")
      .then((response) {
    print(response.status); // NO, because credentials are invalid
  });
  await client.logout().then((response) {
    print(response.fullResponse);
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  imap_client: ^0.1.3

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.3 Aug 11, 2018 Go to the documentation of imap_client 0.1.3 Download imap_client 0.1.3 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
Popularity:
Describes how popular the package is relative to other packages. [more]
55
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]
77
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, other

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

Dependencies

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