{"id":15555018,"url":"https://github.com/michaelspiss/imap_client","last_synced_at":"2025-04-23T20:25:05.393Z","repository":{"id":56832895,"uuid":"135605095","full_name":"michaelspiss/imap_client","owner":"michaelspiss","description":"IMAP (version 4rev1) implementation for dart","archived":false,"fork":false,"pushed_at":"2020-04-14T11:02:07.000Z","size":224,"stargazers_count":21,"open_issues_count":5,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T04:55:58.924Z","etag":null,"topics":["dart","dartlang","imap-client","imap-protocol"],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/imap_client","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelspiss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-31T15:51:28.000Z","updated_at":"2024-03-26T07:37:02.000Z","dependencies_parsed_at":"2022-09-09T00:00:45.728Z","dependency_job_id":null,"html_url":"https://github.com/michaelspiss/imap_client","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelspiss%2Fimap_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelspiss%2Fimap_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelspiss%2Fimap_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelspiss%2Fimap_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelspiss","download_url":"https://codeload.github.com/michaelspiss/imap_client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250507423,"owners_count":21441988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dartlang","imap-client","imap-protocol"],"created_at":"2024-10-02T15:05:42.727Z","updated_at":"2025-04-23T20:25:05.375Z","avatar_url":"https://github.com/michaelspiss.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imap_client\n\nAn interface to get emails via the imap protocol (version 4rev1) \n\nThis interface implements the IMAP protocol (version 4 rev 1) as described in rfc 3501.\nThis package gives easy access to all commands and automatically analyzes responses.\n\nSupported extensions:\n* RFC 2177: IMAP4 IDLE command\n\nThis package is made available under the [GNU General Public License v3.0](https://github.com/michaelspiss/ImapClient/blob/master/LICENSE).\n\n## Usage\n\nThis example connects the client to an imap server:\n\n```dart\nimport 'package:imap_client/imap_client.dart';\n\nmain() async {\n  ImapClient client = new ImapClient();\n  \n  await client.connect(\"imap.gmail.com\", 993, true);\n}\n```\n\nAll commands are async methods that can be `await`ed for. On completion,\nmost return an enum `ImapTaggedResponse`, which can be either:\n* OK: success\n* NO: command was unsuccessful\n* BAD: command not accepted by the server\n\nSometimes, there are commands which have  other return data, like `fetch` or `list`.\n\nTo select a folder, a simple call to `getFolder()` is sufficient:\n```dart\nimport 'package:imap_client/imap_client.dart';\n\nmain() async {\n  ImapClient client = new ImapClient();\n  \n  await client.connect(\"imap.gmail.com\", 993, true);\n  \n  ImapFolder inbox = client.getFolder(\"inbox\");\n}\n```\nThis `ImapFolder` instance allows for actions in this specific folder.\nFolders can only exist once per name, so another call to `ImapClient.getFolder()` with\nthe same name will return **the same** `ImapFolder` instance! If an instance\nis no longer needed, it can be marked for garbage collection via `ImapFolder.destroy()`.\nThis will free up some ram and should especially be considered when working with\nmany folders.\n\nThere are two types of handlers that are highly suggested to be implemented:\n##### ALERT handler:\n```dart\nvoid Function(String message)\n```\nThe messages passed to this function are directly from the server and must be\nshown to the user (as defined in the protocol).\n\n##### EXPUNGE handler:\n```dart\nvoid Function(int number)\n```\nThis function receives message numbers of messages that have been deleted.\n\nBoth can be set directly via the client instance, either via `client.expungeHandler = ...`\nor `client.alertHandler = ...`\n\n`ImapFolder.store()`, `ImapFolder.fetch()` and `ImapFolder.copy()` need messages to work with.\nThose messages can either be provided via the optional `messageId` parameter, or if ranges are needed,\nvia the optional `messageIdRanges`. One of the two must always be given.\n\nRanges have the following format: `start:end`, whereas `end` can also be `*`, which matches the\nhighest possible number as determined by the server. This means that `1:*` would match every mail in this folder.\n\nTo use message `uid`s instead of relative numbers, the optional parameter `uid` can be set to `true`.\nPlease note that responses from the server will also use `uid`s instead of relative numbers.\n\nExample:\n```dart\nawait inbox.fetch([\"BODY\"], messageIds: [1]);\n```\n\n### Authentication\nThe last important thing would be logging in. There are three possible ways:\n\n##### Preauth\nPreauth means that the client is already registered, this might be because credentials were\nalready submitted via the url on connect.\n\n##### Login\nThe `login` command takes a username and password as parameters.\n```dart\nawait client.login(\"username\", \"password\");\n``` \n\n##### Authenticate\nThe `authenticate` command is used for any other authentication mechanisms. It takes an\n`ImapSaslMechanism` object and logs in via the mechanism defined there. \"login\" and \"plain\"\nare both already implemented, a short walk through on how to create a custom mechanism can\nbe found [in the wiki](https://github.com/michaelspiss/imap_client/wiki/Create-custom-SASL-(authentication)-mechanism).\n\n```dart\nawait client.authenticate(new ImapPlainAuth(\"username\", \"password\"));\n```\n### Closing the connection\nTo close the connection, `logout` can either be called in a folder or the client itself.\n\n## Features and bugs\nFeel free to contribute to this project.\n\nIf you find a bug or think of a new feature, but don't know how to fix/implement it, please [open an issue](https://github.com/michaelspiss/imap_client/issues).\n\nIf you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/michaelspiss/imap_client/pulls).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelspiss%2Fimap_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelspiss%2Fimap_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelspiss%2Fimap_client/lists"}