mailledger-core

Crates.iomailledger-core
lib.rsmailledger-core
version0.0.2
created_at2026-01-14 14:09:26.364555+00
updated_at2026-01-17 17:35:05.119665+00
descriptionCore business logic and services for MailLedger email client
homepagehttps://github.com/mqasimca/mailledger
repositoryhttps://github.com/mqasimca/mailledger
max_upload_size
id2042883
size192,155
Qasim (mqasimca)

documentation

README

mailledger-core

Core business logic and services for the MailLedger email client.

Features

  • Account management: Create, configure, and manage email accounts
  • Credential storage: Secure storage via system keyring
  • Email services: High-level APIs for common email operations
  • Message synchronization: Sync messages between server and local storage
  • Local storage: SQLite-based message and account storage

Components

Account Management

use mailledger_core::{Account, AccountId, ImapConfig, SmtpConfig, Security};

// Create account configuration
let account = Account {
    id: AccountId::new(1),
    name: "Work Email".to_string(),
    email: "user@company.com".to_string(),
    imap: ImapConfig {
        host: "imap.company.com".to_string(),
        port: 993,
        security: Security::Implicit,
    },
    smtp: SmtpConfig {
        host: "smtp.company.com".to_string(),
        port: 587,
        security: Security::StartTls,
    },
};

Credential Storage

use mailledger_core::credentials;

// Store credentials securely in system keyring
credentials::store_password(account_id, "password")?;
credentials::store_oauth_token(account_id, &token)?;

// Retrieve credentials
let password = credentials::get_password(account_id)?;
let token = credentials::get_oauth_token(account_id)?;

Email Services

use mailledger_core::{connect_and_login, list_folders, fetch_messages};

// Connect and authenticate
let client = connect_and_login(&account, &credentials).await?;

// List folders
let folders = list_folders(&client).await?;

// Fetch messages
let messages = fetch_messages(&client, "INBOX", 1..=50).await?;

License

MIT License - see LICENSE for details.

Commit count: 6

cargo fmt