Skip to content

Commit

Permalink
release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Mar 21, 2021
1 parent 2d07a23 commit f483676
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 67 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 1.0.0 (not yet released)
# 1.0.0
- `enough_mail` is now [null safe](https://dart.dev/null-safety/tour) #127
- Support `zulu` timezone in date decoding #132
- When the `MailClient` loses a connection or reconnects, it will now fire corresponding `MailConnectionLost` and `MailConnectionReEstablished` events.
- When the `MailClient` reconnects, it will fetch new messages automatically and notify about them using `MailLoadEvent`.
- When the `MailClient` reconnects, it will fetch new messages automatically and notify about them using `MailLoadEvent`.
- Breaking changes to `v0.3`:
* `MessageBuilder.encoding` is renamed to `MessageBuilder.transferEncoding` and the `enum` previously called `MessageEncoding` is now called `TransferEncoding`. All optional parameters previously called `encoding` are now also named `transferEncoding`.
* `MetaDataEntry.entry` has been renamed to `MetaDataEntry.name`.
Expand Down
69 changes: 5 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IMAP, POP3 and SMTP clients for Dart developers.
IMAP, POP3 and SMTP clients for Dart and Flutter email developers.

Available under the commercial friendly
[MPL Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/).
Expand All @@ -9,7 +9,7 @@ Add this dependency your pubspec.yaml file:

```
dependencies:
enough_mail: ^0.3.0
enough_mail: ^1.0.0
```
The latest version or `enough_mail` is [![enough_mail version](https://img.shields.io/pub/v/enough_mail.svg)](https://pub.dartlang.org/packages/enough_mail).

Expand Down Expand Up @@ -205,67 +205,8 @@ void printMessage(MimeMessage message) {
}
```

## Migrating

If you have been using a 0.0.x version of the API you need to switch from evaluating responses to just getting the data and handling exceptions if something went wrong.

Old code example:
```dart
final client = ImapClient(isLogEnabled: false);
await client.connectToServer(imapServerHost, imapServerPort,
isSecure: isImapServerSecure);
final loginResponse = await client.login(userName, password);
if (loginResponse.isOkStatus) {
final listResponse = await client.listMailboxes();
if (listResponse.isOkStatus) {
print('mailboxes: ${listResponse.result}');
final inboxResponse = await client.selectInbox();
if (inboxResponse.isOkStatus) {
// fetch 10 most recent messages:
final fetchResponse = await client.fetchRecentMessages(
messageCount: 10, criteria: 'BODY.PEEK[]');
if (fetchResponse.isOkStatus) {
final messages = fetchResponse.result.messages;
for (var message in messages) {
printMessage(message);
}
}
}
}
await client.logout();
}
```

Migrated code example:
```dart
final client = ImapClient(isLogEnabled: false);
try {
await client.connectToServer(imapServerHost, imapServerPort,
isSecure: isImapServerSecure);
await client.login(userName, password);
final mailboxes = await client.listMailboxes();
print('mailboxes: ${mailboxes}');
await client.selectInbox();
// fetch 10 most recent messages:
final fetchResult = await client.fetchRecentMessages(
messageCount: 10, criteria: 'BODY.PEEK[]');
for (var message in fetchResult.messages) {
printMessage(message);
}
await client.logout();
} on ImapException catch (e) {
print('imap failed with $e');
}
```

As you can see the code is now much simpler and shorter.

Depending on which API you use there are different exceptions to handle:
* `MailException` for the high level API
* `ImapException` for the low level IMAP API
* `PopException` for the low level POP3 API
* `SmtpException` for the low level SMTP API

## Migrating from v0.0.x?
Please [follow the instructions](https://github.com/Enough-Software/enough_mail/migration.md).

## Related Projects
Check out these related projects:
Expand Down Expand Up @@ -331,7 +272,7 @@ Character encodings:
* UTF-8 (uft8, 8bit)
* ISO-8859-1 (latin-1)
* ISO-8859-2 - 16 (latin-2 - 16)
* Windows-1250, 1251, 1252
* Windows-1250, 1251, 1252, 1253 and 1254
* GB-2312 and GBK

Transfer encodings:
Expand Down
60 changes: 60 additions & 0 deletions migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## Migrating

If you have been using a 0.0.x version of the API you need to switch from evaluating responses to just getting the data and handling exceptions if something went wrong.

Old code example:
```dart
final client = ImapClient(isLogEnabled: false);
await client.connectToServer(imapServerHost, imapServerPort,
isSecure: isImapServerSecure);
final loginResponse = await client.login(userName, password);
if (loginResponse.isOkStatus) {
final listResponse = await client.listMailboxes();
if (listResponse.isOkStatus) {
print('mailboxes: ${listResponse.result}');
final inboxResponse = await client.selectInbox();
if (inboxResponse.isOkStatus) {
// fetch 10 most recent messages:
final fetchResponse = await client.fetchRecentMessages(
messageCount: 10, criteria: 'BODY.PEEK[]');
if (fetchResponse.isOkStatus) {
final messages = fetchResponse.result.messages;
for (var message in messages) {
printMessage(message);
}
}
}
}
await client.logout();
}
```

Migrated code example:
```dart
final client = ImapClient(isLogEnabled: false);
try {
await client.connectToServer(imapServerHost, imapServerPort,
isSecure: isImapServerSecure);
await client.login(userName, password);
final mailboxes = await client.listMailboxes();
print('mailboxes: ${mailboxes}');
await client.selectInbox();
// fetch 10 most recent messages:
final fetchResult = await client.fetchRecentMessages(
messageCount: 10, criteria: 'BODY.PEEK[]');
for (var message in fetchResult.messages) {
printMessage(message);
}
await client.logout();
} on ImapException catch (e) {
print('imap failed with $e');
}
```

As you can see the code is now much simpler and shorter.

Depending on which API you use there are different exceptions to handle:
* `MailException` for the high level API
* `ImapException` for the low level IMAP API
* `PopException` for the low level POP3 API
* `SmtpException` for the low level SMTP API
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: enough_mail
description: IMAP, POP3 and SMTP in pure Dart. Choose between a low level and a high level API for mailing. Parse and generate MIME messages. Discover email settings.
description: IMAP, POP3 and SMTP for email developers. Choose between a low level and a high level API for mailing. Parse and generate MIME messages. Discover email settings.
version: 1.0.0
homepage: https://github.com/Enough-Software/enough_mail

Expand Down

0 comments on commit f483676

Please sign in to comment.