| Crates.io | mailledger-core |
| lib.rs | mailledger-core |
| version | 0.0.2 |
| created_at | 2026-01-14 14:09:26.364555+00 |
| updated_at | 2026-01-17 17:35:05.119665+00 |
| description | Core business logic and services for MailLedger email client |
| homepage | https://github.com/mqasimca/mailledger |
| repository | https://github.com/mqasimca/mailledger |
| max_upload_size | |
| id | 2042883 |
| size | 192,155 |
Core business logic and services for the MailLedger email client.
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,
},
};
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)?;
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?;
MIT License - see LICENSE for details.