dev_imap_client 0.0.1
dev_imap_client: ^0.0.1 copied to clipboard
A Dart IMAP client for connecting to mail servers, retrieving emails, and managing mailboxes with secure SSL/TLS support.
📧 DevIMAPClient #
A lightweight IMAP client for Dart and Flutter applications. Connect to mail servers, retrieve emails, and manage mailboxes with secure SSL/TLS support.
✨ Features #
- 🔒 Secure Connections - SSL/TLS support for encrypted communication
- 🔑 Authentication - Simple login/logout functionality
- 📁 Mailbox Management - List available mailboxes
- 📨 Email Retrieval - Fetch email subjects from INBOX
- 🐞 Debug Logging - Toggle detailed logging for development
📦 Installation #
Add this to your package's pubspec.yaml file:
dependencies:
dev_imap_client: ^0.0.1
Then run:
flutter pub get
🚀 Usage #
Basic Example #
import 'package:dev_imap_client/dev_imap_client.dart';
void main() async {
// Enable debug logs (optional)
DevIMAPClient.enableDebugLogs(true);
// Create client instance
final client = DevIMAPClient(
host: 'imap.gmail.com',
port: 993,
isSecure: true,
);
// Connect and authenticate
await client.connect('your.email@example.com', 'your_password');
// Fetch mailboxes & subjects
await client.listMailboxes();
await client.fetchInboxSubjects();
// Disconnect when done
await client.disconnect();
}
📋 API Reference #
DevIMAPClient #
The main class for interacting with IMAP servers.
Constructor
DevIMAPClient({
required String host,
required int port,
bool isSecure = true,
})
| Parameter | Type | Description |
|---|---|---|
host |
String |
IMAP server hostname |
port |
int |
IMAP server port |
isSecure |
bool |
Whether to use SSL/TLS (default: true) |
Methods
| Method | Description |
|---|---|
static void enableDebugLogs([bool value = true]) |
Enable or disable debug logging globally |
Future<void> connect(String username, String password) |
Connect to the IMAP server and authenticate |
Future<void> listMailboxes() |
Fetch list of available mailboxes |
Future<void> fetchInboxSubjects() |
Select inbox and fetch email subjects |
Future<void> disconnect() |
Logout and close connection |
🏗️ Architecture #
Package Structure #
lib/
└── dev_imap_client.dart # Main package entry point
Component Interaction #
graph TD
A[Application] -->|Creates| B[DevIMAPClient]
B -->|Connects to| C[IMAP Server]
B -->|Authenticates with| C
B -->|Requests mailboxes from| C
B -->|Fetches emails from| C
B -->|Disconnects from| C
🔄 Data Flow #
-
Connection Initialization
- Client creates socket connection to IMAP server
- SSL/TLS negotiation if secure mode enabled
-
Authentication
- Client sends login credentials
- Server validates and establishes session
-
Command Execution
- Client sends IMAP commands (LIST, SELECT, FETCH)
- Server responds with requested data
-
Session Termination
- Client sends LOGOUT command
- Connection closed
💻 Platform Support #
| Platform | Supported |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| macOS | ✅ |
| Windows | ✅ |
| Linux | ✅ |
| Web | ❌ |
⚠️ Limitations #
- Basic IMAP functionality only
- No support for message composition or sending
- Limited parsing of complex IMAP responses
- Not supported on Web platform
📝 License #
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.