| Crates.io | avila-cell |
| lib.rs | avila-cell |
| version | 0.4.0 |
| created_at | 2025-12-02 01:38:42.016916+00 |
| updated_at | 2025-12-02 02:24:15.946547+00 |
| description | Advanced email protocol cells - SMTP/POP3/IMAP with MIME multipart, Base64, authentication, HTML emails - First digital life form |
| homepage | https://avila.inc |
| repository | https://github.com/avilaops/arxis |
| max_upload_size | |
| id | 1960970 |
| size | 109,444 |
First digital life form - Advanced email protocol cells with MIME multipart, authentication, and HTML support
multipart/mixed - For attachmentsmultipart/alternative - For HTML + plain textmultipart/related - For inline imagesZero external dependencies - built entirely on the Avila ecosystem:
avila-atom - Data structuresavila-molecule - Network protocolsavila-error - Error handlingavila-time - Temporal operationsavila-async - Asynchronous runtimeavila-crypto - Cryptographic functionsavila-regex - Pattern matchingavila-serde - Serializationuse avila_cell::{Email, EmailAddress, smtp::SmtpClient};
let from = EmailAddress::new("sender@example.com", None);
let to = EmailAddress::new("recipient@example.com", Some("John Doe".to_string()));
let email = Email::new(from, vec![to], "Hello", "This is a test email");
let mut client = SmtpClient::new("smtp.example.com", 587)?;
client.connect()?;
client.send_email(&email)?;
use avila_cell::{Email, EmailAddress, mime::{MimePart, MultipartBuilder}};
let from = EmailAddress::new("sender@example.com", None);
let to = EmailAddress::new("recipient@example.com", None);
let mut email = Email::new(from, vec![to], "Invoice", "");
// Add HTML body
email.html_body = Some("<h1>Invoice</h1><p>Please find attached.</p>".to_string());
// Add attachment
email.attachments.push(MimePart::attachment(
"invoice.pdf",
"application/pdf",
vec![/* PDF bytes */]
));
let mut client = SmtpClient::new("smtp.gmail.com", 587)?;
client.connect()?;
client.auth_plain("user@gmail.com", "password")?;
client.send_email(&email)?;
use avila_cell::smtp::{SmtpClient, SmtpSecurity};
let mut client = SmtpClient::with_security(
"smtp.gmail.com",
587,
SmtpSecurity::StartTls
)?;
client.connect()?;
// PLAIN authentication
client.auth_plain("user@gmail.com", "password")?;
// Or LOGIN authentication
client.auth_login("user@gmail.com", "password")?;
// Or XOAUTH2 for Gmail
client.auth_xoauth2("user@gmail.com", "ya29.access_token")?;
client.send_email(&email)?;
use avila_cell::mime::{MimePart, MultipartBuilder};
// Create multipart/alternative (HTML + plain text)
let multipart = MultipartBuilder::alternative()
.add_part(MimePart::text("Plain text version"))
.add_part(MimePart::html("<p>HTML version</p>"));
let content_type = multipart.content_type();
let body = multipart.build();
// Create multipart/mixed (with attachments)
let multipart = MultipartBuilder::mixed()
.add_part(MimePart::text("Email body"))
.add_part(MimePart::attachment(
"document.pdf",
"application/pdf",
pdf_bytes
));
use avila_cell::encoding::{base64_encode, base64_decode, quoted_printable_encode};
// Base64
let encoded = base64_encode(b"Hello World");
let decoded = base64_decode(&encoded)?;
// Quoted-Printable
let encoded = quoted_printable_encode("Héllo Wörld");
// Generate boundary for multipart
let boundary = generate_boundary();
✅ MIME multipart support ✅ Base64 encoding/decoding ✅ SMTP authentication (PLAIN, LOGIN, XOAUTH2) ✅ HTML email support ✅ File attachments
The library is organized into modules:
lib.rs - Core types (Email, EmailAddress)smtp.rs - SMTP client implementationpop3.rs - POP3 client implementationimap.rs - IMAP client implementationmessage.rs - Email message formattingmime.rs - MIME multipart supportencoding.rs - Content encoding utilitiesauth.rs - Authentication mechanismsRun the test suite:
cargo test
Run examples:
cargo run --example basic_usage
cargo run --example gmail_client
MIT OR Apache-2.0
Part of the Avila ecosystem - First digital life form