Skip to main content

OutgoingEmail

Struct OutgoingEmail 

Source
#[non_exhaustive]
pub struct OutgoingEmail {
Show 14 fields pub from: Vec<Address>, pub sender: Option<Address>, pub to: Vec<Address>, pub cc: Vec<Address>, pub bcc: Vec<Address>, pub reply_to: Vec<Address>, pub date: Option<DateTime>, pub subject: String, pub body_text: Option<String>, pub body_html: Option<String>, pub in_reply_to: Vec<String>, pub references: Vec<String>, pub attachments: Vec<OutgoingAttachment>, pub extra_headers: Vec<(HeaderName, String)>,
}
Expand description

An outgoing email to be built into raw RFC 5322 bytes.

Used as input to crate::build_message.

§References

  • RFC 5322 (message format)
  • RFC 2046 (MIME multipart)

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§from: Vec<Address>

Originator mailboxes (RFC 5322 Section 3.6.2: from = "From:" mailbox-list).

Must contain at least one address. When multiple addresses are present, sender must be set per RFC 5322 Section 3.6.2: “If the from field contains more than one mailbox specification in the mailbox-list, then the sender field, containing the field value corresponding to the responsible agent, MUST appear in the message.”

§sender: Option<Address>

The agent responsible for actual transmission of the message (RFC 5322 Section 3.6.2: sender = "Sender:" mailbox).

Required when from contains more than one address. Optional when from contains exactly one address.

§to: Vec<Address>

To recipients (RFC 5322 Section 3.6.3).

§cc: Vec<Address>

Cc recipients (RFC 5322 Section 3.6.3).

§bcc: Vec<Address>

Bcc recipients — included in SMTP envelope (RCPT TO) but must not appear in message headers (RFC 5322 Section 3.6.3).

§reply_to: Vec<Address>

Reply-To addresses (RFC 5322 Section 3.6.2: address-list).

§date: Option<DateTime>

Explicit origination date (RFC 5322 Section 3.6.1).

When None, crate::build_message uses the current UTC time. Set this when building drafts, re-sending, or importing messages that require a specific date.

§subject: String

Subject line (RFC 5322 Section 3.6.5).

§body_text: Option<String>

Plain text body.

§body_html: Option<String>

HTML body.

§in_reply_to: Vec<String>

In-Reply-To message-IDs — bare addr-spec values (no angle brackets), builder wraps each in angle brackets for the wire format and silently drops malformed IDs (RFC 5322 Section 3.6.4: in-reply-to = 1*msg-id).

Accepts plain strings so that parsed message-IDs (which may be non-conformant) can flow directly from ParsedEmail into a reply without fallible conversion.

§references: Vec<String>

References message-IDs — bare addr-spec values (no angle brackets), builder wraps each in angle brackets for the wire format and silently drops malformed IDs (RFC 5322 Section 3.6.4: references = 1*msg-id).

Accepts plain strings for the same reason as in_reply_to.

§attachments: Vec<OutgoingAttachment>

File attachments.

§extra_headers: Vec<(HeaderName, String)>

Additional headers to include verbatim (RFC 5322 Section 3.6.8).

Each entry is a (field-name, unstructured-value) pair. The HeaderName newtype enforces RFC 5322 Section 2.2 ftext syntax at construction time. Values are sanitized (CR/LF stripped) and long lines are folded per RFC 5322 Section 2.2.3. Headers are emitted after the standard headers (From, To, Subject, etc.) in the order they appear here.

Trait Implementations§

Source§

impl Clone for OutgoingEmail

Source§

fn clone(&self) -> OutgoingEmail

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutgoingEmail

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OutgoingEmail

Source§

fn default() -> OutgoingEmail

Returns the “default value” for a type. Read more
Source§

impl Hash for OutgoingEmail

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for OutgoingEmail

Source§

fn eq(&self, other: &OutgoingEmail) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for OutgoingEmail

Source§

impl StructuralPartialEq for OutgoingEmail

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.