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:
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("imap.gmail.com", 993, true).then((response) {
print(response.fullResponse);
});
}
All commands are async methods that can be await
ed 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:
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) { ... }
Please file feature requests and bugs at the issue tracker.
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);
});
}
Add this to your package's pubspec.yaml file:
dependencies:
imap_client: ^0.1.3
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.
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 |
|
|
0.1.2 | Jul 14, 2018 |
|
|
0.1.1 | Jul 14, 2018 |
|
|
0.1.0 | Jul 13, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
50
|
Health:
Code health derived from static analysis.
[more]
|
98
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
100
|
Overall:
Weighted score of the above.
[more]
|
74
|
We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, other
Primary library:
package:imap_client/imap_client.dart
with components:io
.
Fix lib/src/imap_client.dart
. (-1.49 points)
Analysis of lib/src/imap_client.dart
reported 3 hints:
line 157 col 8: Don't explicitly initialize variables to null.
line 197 col 8: Don't explicitly initialize variables to null.
line 625 col 7: Future
results in async
function bodies must be await
ed or marked unawaited
using package:pedantic
.
Fix lib/src/imap_analyzer.dart
. (-0.50 points)
Analysis of lib/src/imap_analyzer.dart
reported 1 hint:
line 81 col 34: Don't explicitly initialize variables to null.
Fix lib/src/imap_connection.dart
. (-0.50 points)
Analysis of lib/src/imap_connection.dart
reported 1 hint:
line 24 col 8: Don't explicitly initialize variables to null.