Skip to content

RustUse/use-email

RustUse/use-email

Email addresses, headers, messages, MIME, SMTP vocabulary, envelope identity, message identity, mailto: URIs, and authentication metadata primitives.

use-email is a RustUse facade workspace. It provides composable, dependency-light primitives for working with email concepts without sending mail, receiving mail, connecting to providers, or owning infrastructure.

Experimental

use-email is experimental while the workspace remains below 0.3.0. Expect small API refinements during the first release wave.

Non-goals

use-email is not:

  • an SMTP client
  • an IMAP or POP3 client
  • a mail server
  • a queue or delivery system
  • a templating framework
  • a provider SDK
  • a DNS, TLS, or async networking layer
  • a complete RFC parser or renderer

The crates avoid sockets, TLS, async runtimes, DNS lookups, provider integrations, message delivery, mailbox access, full MIME rendering, and full RFC parsing.

Workspace crates

Crate Path Purpose
use-email crates/use-email/ Feature-gated facade over the email primitive crates
use-email-address crates/use-email-address/ Address, local-part, domain, mailbox, list, and group primitives
use-email-header crates/use-email-header/ Header name, value, field, line, block, and common header wrappers
use-email-message crates/use-email-message/ Message headers, body, kind, raw/parsed containers, and simple builders
use-email-envelope crates/use-email-envelope/ SMTP envelope identity and path primitives
use-email-id crates/use-email-id/ Message-ID, References, In-Reply-To, and thread reference primitives
use-mailto crates/use-mailto/ mailto: URI addresses, fields, queries, and builders
use-smtp crates/use-smtp/ SMTP command, reply, status, extension, and capability vocabulary without network I/O
use-email-auth crates/use-email-auth/ Authentication metadata facade over SPF, DKIM, and DMARC primitives
use-spf crates/use-spf/ SPF record metadata primitives without DNS lookup or policy evaluation
use-dkim crates/use-dkim/ DKIM signature and tag metadata without signing or verification
use-dmarc crates/use-dmarc/ DMARC policy and report metadata without enforcement or report ingestion

use-mime is reused from the sibling use-web workspace. This avoids creating a duplicate crates.io package name while still giving the email facade a mime module.

Basic usage

use use_email::address::{EmailAddress, Mailbox};
use use_email::envelope::{Envelope, EnvelopeRecipient, EnvelopeSender};
use use_email::message::EmailMessage;

let from = Mailbox::new(Some("Jane Doe"), "jane@example.com")?;
let to: EmailAddress = "team@example.com".parse()?;
let message = EmailMessage::plain_text("Hello", "A short note.").with_header("From", from.to_string())?;
let envelope = Envelope::new(EnvelopeSender::new("bounce@example.com")?)
    .with_recipient(EnvelopeRecipient::from_email_address(to));

assert_eq!(message.subject(), Some("Hello"));
assert_eq!(envelope.recipients().len(), 1);
# Ok::<(), Box<dyn std::error::Error>>(())

Message identity and envelope identity

Message headers describe the visible message. For example, From: "Jane Doe" <jane@example.com> is part of the message content and may be shown to a person.

SMTP envelope paths describe transport routing. For example, MAIL FROM:<bounce@example.com> can be different from the visible From header and is modeled by use-email-envelope and use-smtp.

SMTP scope

use-smtp is a protocol vocabulary crate. It models commands, replies, status codes, extension labels, and capability markers. It does not open sockets, negotiate TLS, authenticate, send messages, receive messages, or manage delivery state.

Authentication metadata scope

use-spf, use-dkim, and use-dmarc model record and result metadata. They do not perform DNS lookup, cryptographic signing, cryptographic verification, report ingestion, or policy enforcement.

Installation

Use the workspace directly or depend on a Git revision until the first crates.io release is published.

[dependencies]
use-email = { git = "https://github.com/RustUse/use-email", rev = "<commit>" }

After publication, choose the narrowest focused crate that matches your use case or use the facade when one dependency is more convenient.

[dependencies]
use-email = "0.1.0"

Development

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
cargo test --workspace --no-default-features
cargo check --workspace --all-features --examples

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors