Skip to main content

EnvelopeAddress

Struct EnvelopeAddress 

Source
#[non_exhaustive]
pub struct EnvelopeAddress { pub name: Option<String>, pub adl: Option<String>, pub mailbox: Option<String>, pub host: Option<String>, }
Expand description

A single address entry from an ENVELOPE (RFC 3501 Section 7.4.2 / RFC 9051 Section 7.5.2).

Named EnvelopeAddress to distinguish from daaki_message::Address (RFC 5322 Section 3.4), which is a simpler name+email pair. This type carries the full IMAP 4-tuple.

Group syntax is represented as:

  • Group start: host is None, mailbox holds the group name.
  • Group end: both host and mailbox are None.

Use EnvelopeAddress::is_group_start and EnvelopeAddress::is_group_end to detect these markers.

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.
§name: Option<String>

Display name, RFC 2047 decoded (RFC 3501 Section 7.4.2 / RFC 9051 Section 7.5.2). When UTF8=ACCEPT (RFC 6855 Section 3) is active, contains raw UTF-8 per RFC 6532 Section 3.

§adl: Option<String>

SMTP at-domain-list (source route) — almost always None in practice (RFC 3501 Section 7.4.2 / RFC 9051 Section 7.5.2).

§mailbox: Option<String>

Mailbox (local-part), or group name for group-start markers (RFC 3501 Section 7.4.2 / RFC 9051 Section 7.5.2).

§host: Option<String>

Host (domain part), or None for group markers (RFC 3501 Section 7.4.2 / RFC 9051 Section 7.5.2).

Implementations§

Source§

impl EnvelopeAddress

Source

pub fn email(&self) -> Option<String>

Returns the full email address as mailbox@host, or None if either part is missing or empty (including for group markers).

RFC 5322 Section 3.4.1: addr-spec = local-part "@" domain — both local-part and domain are required to be non-empty.

Source

pub fn is_group_start(&self) -> bool

Returns true if this is an RFC 5322 group start marker.

Per RFC 3501 Section 7.4.2: host is NIL, mailbox holds the group name.

Source

pub fn is_group_end(&self) -> bool

Returns true if this is an RFC 5322 group end marker.

Per RFC 3501 Section 7.4.2: both host and mailbox are NIL.

Source

pub fn is_address(&self) -> bool

Returns true if this is a real address (not a group marker).

Source

pub fn to_message_address(&self) -> Option<Address>

Converts this IMAP address to a daaki_message::Address.

Returns None for group markers (where both mailbox and host are not present). For real addresses, combines mailbox@host into the email field.

This eliminates the boilerplate conversion that consumers otherwise need at every IMAP→message boundary.

§References
  • RFC 3501 Section 7.4.2 (ENVELOPE address structure)
  • RFC 5322 Section 3.4 (address specification)

Trait Implementations§

Source§

impl Clone for EnvelopeAddress

Source§

fn clone(&self) -> EnvelopeAddress

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 EnvelopeAddress

Source§

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

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

impl Default for EnvelopeAddress

Source§

fn default() -> EnvelopeAddress

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

impl From<&EnvelopeAddress> for Address

Converts an IMAP ENVELOPE address to a daaki_message::Address.

Group markers (where email() returns None) produce an Address with an empty email field. Use EnvelopeAddress::to_message_address if you need to filter those out.

§References

  • RFC 3501 Section 7.4.2 (ENVELOPE address structure)
Source§

fn from(addr: &EnvelopeAddress) -> Self

Converts to this type from the input type.
Source§

impl From<EnvelopeAddress> for Address

Owned conversion from IMAP envelope address to message address.

Source§

fn from(addr: EnvelopeAddress) -> Self

Converts to this type from the input type.
Source§

impl Hash for EnvelopeAddress

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 EnvelopeAddress

Source§

fn eq(&self, other: &EnvelopeAddress) -> 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 EnvelopeAddress

Source§

impl StructuralPartialEq for EnvelopeAddress

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more