{"id":15554989,"url":"https://github.com/enough-software/enough_mail","last_synced_at":"2025-05-16T18:10:11.171Z","repository":{"id":39118741,"uuid":"236183184","full_name":"Enough-Software/enough_mail","owner":"Enough-Software","description":"IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.","archived":false,"fork":false,"pushed_at":"2025-01-02T11:57:37.000Z","size":2246,"stargazers_count":116,"open_issues_count":39,"forks_count":58,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-03T19:13:17.387Z","etag":null,"topics":["dart","dartlang","email","encodings","imap","imap-client","imap-extensions","imap-library","mail","mail-flutter","mime","mime-parser","pop3","pop3-client","pop3-library","smtp","smtp-client","smtp-library"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Enough-Software.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-25T14:48:16.000Z","updated_at":"2025-02-27T18:37:24.000Z","dependencies_parsed_at":"2023-12-08T18:25:51.676Z","dependency_job_id":"c01c70f5-8d74-4099-a750-059f522cbb77","html_url":"https://github.com/Enough-Software/enough_mail","commit_stats":{"total_commits":623,"total_committers":20,"mean_commits":31.15,"dds":0.4221508828250401,"last_synced_commit":"0df187c1d155834713186e598b510313d333d3b4"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enough-Software%2Fenough_mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enough-Software%2Fenough_mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enough-Software%2Fenough_mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enough-Software%2Fenough_mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Enough-Software","download_url":"https://codeload.github.com/Enough-Software/enough_mail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248606862,"owners_count":21132428,"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","email","encodings","imap","imap-client","imap-extensions","imap-library","mail","mail-flutter","mime","mime-parser","pop3","pop3-client","pop3-library","smtp","smtp-client","smtp-library"],"created_at":"2024-10-02T15:05:32.248Z","updated_at":"2025-04-12T17:38:35.273Z","avatar_url":"https://github.com/Enough-Software.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"IMAP, POP3 and SMTP clients for Dart and Flutter email developers.\n\nAvailable under the commercial friendly \n[MPL Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/).\n\n\n## Installation\nAdd this dependency your pubspec.yaml file:\n\n```\ndependencies:\n  enough_mail: ^2.1.5\n```\nThe 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).\n\n\n## API Documentation\nCheck out the full API documentation at https://pub.dev/documentation/enough_mail/latest/\n\n## High Level API Usage\n\nThe high level API abstracts away from IMAP and POP3 details, reconnects automatically and allows to easily watch a mailbox for new messages.\nA simple usage example for using the high level API:\n\n```dart\nimport 'dart:io';\nimport 'package:enough_mail/enough_mail.dart';\n\nString userName = 'user.name';\nString password = 'password';\n\nvoid main() async {\n  await mailExample();\n}\n\n\n/// Builds a simple example message\nMimeMessage buildMessage() {\n  final builder = MessageBuilder.prepareMultipartAlternativeMessage(\n    plainText: 'Hello world!',\n    htmlText: '\u003cp\u003eHello world!\u003c/p\u003e',\n  )\n    ..from = [MailAddress('Personal Name', 'sender@domain.com')]\n    ..to = [\n      MailAddress('Recipient Personal Name', 'recipient@domain.com'),\n      MailAddress('Other Recipient', 'other@domain.com')\n    ];\n  return builder.buildMimeMessage();\n}\n\n/// Builds an example message with attachment\nFuture\u003cMimeMessage\u003e buildMessageWithAttachment() async {\n  final builder = MessageBuilder()\n    ..from = [MailAddress('Personal Name', 'sender@domain.com')]\n    ..to = [\n      MailAddress('Recipient Personal Name', 'recipient@domain.com'),\n      MailAddress('Other Recipient', 'other@domain.com')\n    ]\n    ..addMultipartAlternative(\n      plainText: 'Hello world!',\n      htmlText: '\u003cp\u003eHello world!\u003c/p\u003e',\n    );\n  final file = File.fromUri(Uri.parse('file://./document.pdf'));\n  await builder.addFile(file, MediaSubtype.applicationPdf.mediaType);\n  return builder.buildMimeMessage();\n}\n\n/// High level mail API example\nFuture\u003cvoid\u003e mailExample() async {\n  final email = '$userName@$domain';\n  print('discovering settings for  $email...');\n  final config = await Discover.discover(email);\n  if (config == null) {\n    // note that you can also directly create an account when\n    // you cannot auto-discover the settings:\n    // Compare the [MailAccount.fromManualSettings]\n    // and [MailAccount.fromManualSettingsWithAuth]\n    // methods for details.\n    print('Unable to auto-discover settings for $email');\n    return;\n  }\n  print('connecting to ${config.displayName}.');\n  final account =\n      MailAccount.fromDiscoveredSettings('my account', email, password, config);\n  final mailClient = MailClient(account, isLogEnabled: true);\n  try {\n    await mailClient.connect();\n    print('connected');\n    final mailboxes =\n        await mailClient.listMailboxesAsTree(createIntermediate: false);\n    print(mailboxes);\n    await mailClient.selectInbox();\n    final messages = await mailClient.fetchMessages(count: 20);\n    messages.forEach(printMessage);\n    mailClient.eventBus.on\u003cMailLoadEvent\u003e().listen((event) {\n      print('New message at ${DateTime.now()}:');\n      printMessage(event.message);\n    });\n    await mailClient.startPolling();\n    // generate and send email:\n    final mimeMessage = buildMessage();\n    await mailClient.sendMessage(mimeMessage);\n  } on MailException catch (e) {\n    print('High level API failed with $e');\n  }\n}\n```\n\n## Low Level Usage\n\nA simple usage example for using the low level API:\n\n```dart\nimport 'dart:io';\nimport 'package:enough_mail/enough_mail.dart';\n\nString userName = 'user.name';\nString password = 'password';\nString imapServerHost = 'imap.domain.com';\nint imapServerPort = 993;\nbool isImapServerSecure = true;\nString popServerHost = 'pop.domain.com';\nint popServerPort = 995;\nbool isPopServerSecure = true;\nString smtpServerHost = 'smtp.domain.com';\nint smtpServerPort = 465;\nbool isSmtpServerSecure = true;\n\nvoid main() async {\n  await discoverExample();\n  await imapExample();\n  await smtpExample();\n  await popExample();\n  exit(0);\n}\n\nFuture\u003cvoid\u003e discoverExample() async {\n  var email = 'someone@enough.de';\n  var config = await Discover.discover(email, isLogEnabled: false);\n  if (config == null) {\n    print('Unable to discover settings for $email');\n  } else {\n    print('Settings for $email:');\n    for (var provider in config.emailProviders) {\n      print('provider: ${provider.displayName}');\n      print('provider-domains: ${provider.domains}');\n      print('documentation-url: ${provider.documentationUrl}');\n      print('Incoming:');\n      print(provider.preferredIncomingServer);\n      print('Outgoing:');\n      print(provider.preferredOutgoingServer);\n    }\n  }\n}\n\n/// Low level IMAP API usage example\nFuture\u003cvoid\u003e imapExample() async {\n  final client = ImapClient(isLogEnabled: false);\n  try {\n    await client.connectToServer(imapServerHost, imapServerPort,\n        isSecure: isImapServerSecure);\n    await client.login(userName, password);\n    final mailboxes = await client.listMailboxes();\n    print('mailboxes: $mailboxes');\n    await client.selectInbox();\n    // fetch 10 most recent messages:\n    final fetchResult = await client.fetchRecentMessages(\n        messageCount: 10, criteria: 'BODY.PEEK[]');\n    for (final message in fetchResult.messages) {\n      printMessage(message);\n    }\n    await client.logout();\n  } on ImapException catch (e) {\n    print('IMAP failed with $e');\n  }\n}\n\n/// Low level SMTP API example\nFuture\u003cvoid\u003e smtpExample() async {\n  final client = SmtpClient('enough.de', isLogEnabled: true);\n  try {\n    await client.connectToServer(smtpServerHost, smtpServerPort,\n        isSecure: isSmtpServerSecure);\n    await client.ehlo();\n    if (client.serverInfo.supportsAuth(AuthMechanism.plain)) {\n      await client.authenticate('user.name', 'password', AuthMechanism.plain);\n    } else if (client.serverInfo.supportsAuth(AuthMechanism.login)) {\n      await client.authenticate('user.name', 'password', AuthMechanism.login);\n    } else {\n      return;\n    }\n    final builder = MessageBuilder.prepareMultipartAlternativeMessage(\n      plainText: 'hello world.',\n      htmlText: '\u003cp\u003ehello \u003cb\u003eworld\u003c/b\u003e\u003c/p\u003e',\n    )\n      ..from = [MailAddress('My name', 'sender@domain.com')]\n      ..to = [MailAddress('Your name', 'recipient@domain.com')]\n      ..subject = 'My first message';\n    final mimeMessage = builder.buildMimeMessage();\n    final sendResponse = await client.sendMessage(mimeMessage);\n    print('message sent: ${sendResponse.isOkStatus}');\n  } on SmtpException catch (e) {\n    print('SMTP failed with $e');\n  }\n}\n\n/// Low level POP3 API example\nFuture\u003cvoid\u003e popExample() async {\n  final client = PopClient(isLogEnabled: false);\n  try {\n    await client.connectToServer(popServerHost, popServerPort,\n        isSecure: isPopServerSecure);\n    await client.login(userName, password);\n    // alternative login:\n    // await client.loginWithApop(userName, password); // optional different login mechanism\n    final status = await client.status();\n    print(\n        'status: messages count=${status.numberOfMessages}, messages size=${status.totalSizeInBytes}');\n    final messageList = await client.list(status.numberOfMessages);\n    print(\n        'last message: id=${messageList?.first?.id} size=${messageList?.first?.sizeInBytes}');\n    var message = await client.retrieve(status.numberOfMessages);\n    printMessage(message);\n    message = await client.retrieve(status.numberOfMessages + 1);\n    print('trying to retrieve newer message succeeded');\n    await client.quit();\n  } on PopException catch (e) {\n    print('POP failed with $e');\n  }\n}\n\nvoid printMessage(MimeMessage message) {\n  print('from: ${message.from} with subject \"${message.decodeSubject()}\"');\n  if (!message.isTextPlainMessage()) {\n    print(' content-type: ${message.mediaType}');\n  } else {\n    final plainText = message.decodeTextPlainPart();\n    if (plainText != null) {\n      final lines = plainText.split('\\r\\n');\n      for (final line in lines) {\n        if (line.startsWith('\u003e')) {\n          // break when quoted text starts\n          break;\n        }\n        print(line);\n      }\n    }\n  }\n}\n```\n\n## Related Projects\nCheck out these related projects:\n* [enough_mail_html](https://github.com/Enough-Software/enough_mail_html) generates HTML out of a `MimeMessage`.\n* [enough_mail_flutter](https://github.com/Enough-Software/enough_mail_flutter) provides some common Flutter widgets for any mail app.\n* [enough_mail_icalendar](https://github.com/Enough-Software/enough_mail_icalendar) for handling calendar invites in emails.\n* [enough_mail_app](https://github.com/Enough-Software/enough_mail_app) aims to become a full mail app.\n* [enough_convert](https://github.com/Enough-Software/enough_convert) provides the encodings missing from `dart:convert`.  \n\n## Miss a feature or found a bug?\n\nPlease file feature requests and bugs at the [issue tracker](https://github.com/Enough-Software/enough_mail/issues).\n\n## Contribute\n\nWant to contribute? Please check out [contribute](https://github.com/Enough-Software/enough_mail/contribute).\nThis is an open-source community project. Anyone, even beginners, can contribute.\n\nThis is how you contribute:\n\n* Fork the [enough_mail](https://github.com/enough-software/enough_mail/) project by pressing the fork button.\n* Clone your fork to your computer: `git clone github.com/$your_username/enough_mail`\n* Do your changes. When you are done, commit changes with `git add -A` and `git commit`.\n* Push changes to your personal repository: `git push origin`\n* Go to [enough_mail](https://github.com/enough-software/enough_mail/)  and create a pull request.\n\nThank you in advance!\n\n## Thanks to all Contributors!!\n\u003ca href=\"https://github.com/Enough-Software/enough_mail/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=Enough-Software/enough_mail\" /\u003e\n\u003c/a\u003e\n\n\n## Features\n### Base standards\n* ✅ [IMAP4 rev1](https://tools.ietf.org/html/rfc3501) support \n* ✅ [SMTP](https://tools.ietf.org/html/rfc5321) support\n* ✅ [POP3](https://tools.ietf.org/html/rfc1939) support\n* ✅ [MIME](https://tools.ietf.org/html/rfc2045) parsing and generation support\n\n### IMAP extensions\nThe following IMAP extensions are supported:\n* ✅ [IMAP IDLE](https://tools.ietf.org/html/rfc2177)\n* ✅ [IMAP METADATA](https://tools.ietf.org/html/rfc5464)\n* ✅ [UIDPLUS](https://tools.ietf.org/html/rfc2359) \n* ✅ [MOVE](https://tools.ietf.org/html/rfc6851) \n* ✅ [CONDSTORE](https://tools.ietf.org/html/rfc7162) \n* ✅ [QRESYNC](https://tools.ietf.org/html/rfc7162) \n* ✅ [ENABLE](https://tools.ietf.org/html/rfc5161)\n* ✅ [QUOTA](https://tools.ietf.org/html/rfc2087)\n* ✅ [IMAP Support for UTF-8](https://tools.ietf.org/html/rfc6855) \n* ✅ [ESEARCH](https://tools.ietf.org/html/rfc4731)\n* ✅ [SORT and THREAD](https://tools.ietf.org/html/rfc5256)\n* ✅ [UNSELECT](https://tools.ietf.org/html/rfc3691))\n* ✅ ESORT and PARTIAL from [Contexts](https://tools.ietf.org/html/rfc5267)\n* ✅ List extensions ([rfc5258](https://tools.ietf.org/html/rfc5258), [rfc5819](https://tools.ietf.org/html/rfc5819), [rfc6154](https://tools.ietf.org/html/rfc6154))\n\n### SMTP Extensions\nThe following SMTP extensions are supported:\n* ✅ [8-bit MIME](https://tools.ietf.org/html/rfc6152)\n\n### Security\nThe following security extensions are supported:\n* ✅ Partial signing of messages using [DKIM](https://tools.ietf.org/html/rfc6376)\n \n### Other\n* ✅ [Mailto](https://tools.ietf.org/html/rfc6068) parsing mailto links\n* ✅ [Email provider auto-discovery](https://tools.ietf.org/html/rfc6186) Discover settings for an email address\n\n### Supported encodings\nCharacter encodings:\n* ASCII (7bit)\n* UTF-8 (uft8, 8bit)\n* ISO-8859-1 (latin-1)\n* ISO-8859-2 - 16 (latin-2 - 16)\n* Windows-1250, 1251, 1252, 1253, 1254 and 1256\n* GB-2312, GBK, GB-18030, Chinese, CSGB-2312, CSGB-231280, CSISO-58-GB-231280, ISO-IR-58, X-Mac-ChineseSimp\n* Big5\n* KOI8-r and KOI8-u\n\nTransfer encodings:\n* [Quoted-Printable (Q)](https://tools.ietf.org/html/rfc2045#section-6.7)\n* [Base-64 (base64)](https://tools.ietf.org/html/rfc2045#section-6.8)\n\n### To do\n* Compare [issues](https://github.com/Enough-Software/enough_mail/issues)\n\n### Develop and Contribute\n* To start check out the package and then run `dart run test` to run all tests.\n* Public facing library classes are in *lib*, *lib/imap* and *lib/smtp*. \n* Private classes are in *lib/src*.\n* Test cases are in *test*.\n* Please file a pull request for each improvement/fix that you are create - your contributions are welcome.\n* Check out https://github.com/enough-Software/enough_mail/contribute for good first issues.\n* When changing model files, re-run the code generation by calling  `dart run build_runner build --delete-conflicting-outputs`.\n\n\n## License\n`enough_mail` is licensed under the commercial friendly [Mozilla Public License 2.0](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenough-software%2Fenough_mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenough-software%2Fenough_mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenough-software%2Fenough_mail/lists"}