1 parent
96a32ea8fb
commit
a643e7e3ab
106 files changed
+2223
-4669
No files matched your search
+19
-34
@@ -1,7 +1,3 @@
|
||||
//! SMTP data types.
|
||||
|
||||
/// Parameters needed to establish an SMTP connection.
|
||||
/// Passed explicitly to every trait method so the trait stays stateless.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SmtpCredentials {
|
||||
pub host: String,
|
||||
@@ -18,42 +14,40 @@ pub struct SmtpSendResult {
|
||||
pub rfc822: Vec<u8>,
|
||||
}
|
||||
|
||||
/// A message ready to be sent via SMTP.
|
||||
#[derive(Clone)]
|
||||
pub struct SendableMessage {
|
||||
/// Sender email address.
|
||||
pub from: String,
|
||||
/// Primary recipients.
|
||||
|
||||
pub to: Vec<String>,
|
||||
/// CC recipients.
|
||||
|
||||
pub cc: Vec<String>,
|
||||
/// BCC recipients.
|
||||
|
||||
pub bcc: Vec<String>,
|
||||
/// Optional Reply-To mailbox.
|
||||
|
||||
pub reply_to: Option<String>,
|
||||
/// Optional organization label from the selected identity.
|
||||
|
||||
pub organization: Option<String>,
|
||||
/// Subject line.
|
||||
|
||||
pub subject: String,
|
||||
/// Plain-text body.
|
||||
|
||||
pub text_body: String,
|
||||
/// Optional HTML body.
|
||||
|
||||
pub html_body: Option<String>,
|
||||
/// In-Reply-To header value for threading.
|
||||
|
||||
pub in_reply_to: Option<String>,
|
||||
/// References header value for threading.
|
||||
|
||||
pub references: Option<String>,
|
||||
/// Address that should receive an MDN/read receipt request.
|
||||
|
||||
pub read_receipt_to: Option<String>,
|
||||
/// Message priority: `high`, `normal`, or `low`.
|
||||
|
||||
pub priority: String,
|
||||
/// Administrator-configured headers applied to every outgoing copy.
|
||||
|
||||
pub extra_headers: Vec<(String, String)>,
|
||||
/// File attachments.
|
||||
|
||||
pub attachments: Vec<AttachmentData>,
|
||||
/// Optional OpenPGP transformation applied to the MIME entity.
|
||||
|
||||
pub pgp: Option<PgpSendConfig>,
|
||||
/// Hard limit for the final RFC822/MIME payload submitted to SMTP.
|
||||
|
||||
pub max_message_size_bytes: usize,
|
||||
}
|
||||
|
||||
@@ -74,24 +68,17 @@ pub struct PgpSendConfig {
|
||||
pub recipient_public_keys: Vec<String>,
|
||||
}
|
||||
|
||||
/// A single file attachment to include in an outgoing message.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AttachmentData {
|
||||
/// Filename as it should appear to the recipient.
|
||||
pub filename: String,
|
||||
/// MIME content type (e.g. "application/pdf").
|
||||
|
||||
pub content_type: String,
|
||||
/// Raw file content.
|
||||
|
||||
pub data: Vec<u8>,
|
||||
/// Optional Content-ID for inline images (referenced via `cid:` in HTML).
|
||||
/// When set, the attachment is treated as an inline image rather than a
|
||||
/// regular file attachment.
|
||||
|
||||
pub content_id: Option<String>,
|
||||
}
|
||||
|
||||
/// Apply RustBox-managed optional headers shared by SMTP delivery and the
|
||||
/// copy appended to IMAP Sent. Header names are static and values are stripped
|
||||
/// of CR/LF before they reach lettre's raw header API.
|
||||
pub fn apply_optional_headers(
|
||||
builder: lettre::message::MessageBuilder,
|
||||
message: &SendableMessage,
|
||||
@@ -120,8 +107,6 @@ pub fn apply_optional_headers(
|
||||
builder
|
||||
}
|
||||
|
||||
/// Apply the optional outgoing headers without requiring a full SendableMessage.
|
||||
/// This is also used for RFC822 draft snapshots appended to IMAP.
|
||||
pub fn apply_optional_header_values(
|
||||
mut builder: lettre::message::MessageBuilder,
|
||||
read_receipt_to: Option<&str>,
|
||||
|
||||
Reference in new issue
Block a user