attachment
ModuleFiles carried along with a message.
Contents
use utopia_smtp::Attachment;Rust
pub struct AttachmentA file to carry along, either held in memory or read from disk when the message is written, so a large file is never held twice.
Rust
use utopia_smtp::Attachment;
let logo = Attachment::from_bytes(b"\x89PNG...".to_vec(), "logo.png", Some("image/png"))?.inline("logo")?;
assert_eq!(logo.cid(), Some("logo"));
assert_eq!(logo.mime_type(), "image/png");use utopia_smtp::Source;Rust
pub enum SourceWhere the bytes of an attachment come from.
use utopia_smtp::detect;Rust
pub fn detect(path: &Path) -> &'static strThe media type of a file from its first bytes, for the files a message
usually carries: application/x-empty for an empty file, PNG, GIF, JPEG,
PDF, ZIP and gzip by their signatures, text/plain for UTF-8 text of at
least two bytes, and application/octet-stream for anything else.