Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Aug 26, 2022
1 parent 436c13b commit d76ca63
Show file tree
Hide file tree
Showing 145 changed files with 6,217 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable

project_type: package
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"Imap"
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
109 changes: 109 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Discover email account settings everywhere.

Available under the commercial friendly
[MPL Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/).


## Installation
Add this dependency your pubspec.yaml file:

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

## Demo

Check out https://enough.de/enough_mail_discovery/ for a web demo.
Note that `enough_mail_discovery` can even detect more email setting on non-web systems that support TCP/IP Sockets.

## API Documentation
Check out the full API documentation at https://pub.dev/documentation/enough_mail_discovery/latest/

## API Usage

Just call `Discover.discover(String emailAddress)` to resolve the email address:
```dart
/// Tries to discover mail settings for the specified [emailAddress].
///
/// Optionally set [forceSslConnection] to `true` when not encrypted
/// connections should not be allowed.
///
/// Set [isLogEnabled] to `true` to output debugging information during
/// the discovery process.
///
/// Set [isWeb] to `true` when running on the web platform. Use the
/// `kIsWeb` constant from `package:flutter/foundation.dart` when called
/// from Flutter.
static Future<ClientConfig?> discover(
String emailAddress, {
bool forceSslConnection = false,
bool isLogEnabled = false,
bool isWeb = false,
})
```

Example for command line:
```dart
import 'package:enough_mail_discovery/enough_mail_discovery.dart';
// ignore: avoid_void_async
void main() async {
const email = '[email protected]';
final config = await Discover.discover(email, isLogEnabled: false);
if (config == null) {
print('Unable to discover settings for $email');
} else {
print('Settings for $email:');
for (final provider in config.emailProviders!) {
print('provider: ${provider.displayName}');
print('provider-domains: ${provider.domains}');
print('documentation-url: ${provider.documentationUrl}');
print('Incoming:');
provider.incomingServers?.forEach(print);
print(provider.preferredIncomingServer);
print('Outgoing:');
provider.outgoingServers?.forEach(print);
print(provider.preferredOutgoingServer);
}
}
}
```

## Tool Usage

`enough_mail_discovery` contains the `discover.dart` tool in it's example folder. After cloning the project, run
`dart example/discover.dart [email protected]` to discover the email settings. Use the `--log` option to output more information during
the discovery process, `--ssl` to enforce SSL usage and `--preferred` to only print the preferred incoming and outgoing servers.

## Related Projects
Check out these related projects:
* [enough_mail](https://github.com/Enough-Software/enough_mail) email clients and mime message generation.
* [enough_mail_app](https://github.com/Enough-Software/enough_mail_app) aims to become a full mail app.

## Miss a feature or found a bug?

Please file feature requests and bugs at the [issue tracker](https://github.com/Enough-Software/enough_mail_discovery/issues).

## Contribute

Want to contribute? Please check out [contribute](https://github.com/Enough-Software/enough_mail_discovery/contribute).
This is an open-source community project. Anyone, even beginners, can contribute.

This is how you contribute:

* Fork the [enough_mail_discovery](https://github.com/enough-software/enough_mail_discovery/) project by pressing the fork button.
* Clone your fork to your computer: `git clone github.com/$your_username/enough_mail_discovery`
* Do your changes. When you are done, commit changes with `git add -A` and `git commit`.
* Push changes to your personal repository: `git push origin`
* Go to [enough_mail_discovery](https://github.com/enough-software/enough_mail_discovery/) and create a pull request.

Thank you in advance!




## License
`enough_mail_discovery` is licensed under the commercial friendly [Mozilla Public License 2.0](LICENSE).
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
19 changes: 19 additions & 0 deletions enough_mail_discovery.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
</module>
74 changes: 74 additions & 0 deletions example/discover.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ignore_for_file: avoid_print

import 'package:enough_mail_discovery/enough_mail_discovery.dart';
import 'package:universal_io/io.dart';

// ignore: avoid_void_async
void main(List<String> args) async {
if (args.isEmpty) {
_usage();
}
var forceSsl = false;
var log = false;
var onlyPreferred = false;
var email = args.first;
if (args.length > 1) {
final arguments = [...args];
forceSsl = arguments.remove('--ssl');
log = arguments.remove('--log');
onlyPreferred = arguments.remove('--preferred');
email = arguments.last;
if (arguments.length != 1) {
email = args.firstWhere((arguments) => arguments.contains('@'),
orElse: () => '');
arguments.remove(email);
print('Invalid arguments: $arguments');
_usage();
}
}
if (!email.contains('@')) {
_usage();
}
print('Resolving for email $email...');
final config = await Discover.discover(
email,
forceSslConnection: forceSsl,
isLogEnabled: log,
);
if (config == null) {
print('Unable to discover settings for $email');
} else {
print('Settings for $email:');
for (final provider in config.emailProviders!) {
print('provider: ${provider.displayName}');
print('provider-domains: ${provider.domains}');
print('documentation-url: ${provider.documentationUrl}');
if (!onlyPreferred) {
print('Incoming:');
provider.incomingServers?.forEach(print);
}
print('Preferred incoming:');
print(provider.preferredIncomingServer);
if (!onlyPreferred) {
print('Outgoing:');
provider.outgoingServers?.forEach(print);
}
print('Preferred outgoing:');
print(provider.preferredOutgoingServer);
}
}
exit(0);
}

void _usage() {
print('Tries to discover email settings.');
print('Usage: dart example/discover.dart [options] email');
print('Options:');
print('--ssl: enforce SSL usage');
print('--log: log details during discovery');
print('--preferred: only print the preferred incoming and outgoing servers');
print('');
print('Example:');
print('dart example/discover.dart --log [email protected]');
exit(1);
}
23 changes: 23 additions & 0 deletions example/enough_mail_discovery_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:enough_mail_discovery/enough_mail_discovery.dart';

// ignore: avoid_void_async
void main() async {
const email = '[email protected]';
final config = await Discover.discover(email, isLogEnabled: false);
if (config == null) {
print('Unable to discover settings for $email');
} else {
print('Settings for $email:');
for (final provider in config.emailProviders!) {
print('provider: ${provider.displayName}');
print('provider-domains: ${provider.domains}');
print('documentation-url: ${provider.documentationUrl}');
print('Incoming:');
provider.incomingServers?.forEach(print);
print(provider.preferredIncomingServer);
print('Outgoing:');
provider.outgoingServers?.forEach(print);
print(provider.preferredOutgoingServer);
}
}
}
47 changes: 47 additions & 0 deletions example/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
Loading

0 comments on commit d76ca63

Please sign in to comment.