#[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:
hostisNone,mailboxholds the group name. - Group end: both
hostandmailboxareNone.
Use EnvelopeAddress::is_group_start and EnvelopeAddress::is_group_end to detect these markers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
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
impl EnvelopeAddress
Sourcepub fn email(&self) -> Option<String>
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.
Sourcepub fn is_group_start(&self) -> bool
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.
Sourcepub fn is_group_end(&self) -> bool
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.
Sourcepub fn is_address(&self) -> bool
pub fn is_address(&self) -> bool
Returns true if this is a real address (not a group marker).
Sourcepub fn to_message_address(&self) -> Option<Address>
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
impl Clone for EnvelopeAddress
Source§fn clone(&self) -> EnvelopeAddress
fn clone(&self) -> EnvelopeAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EnvelopeAddress
impl Debug for EnvelopeAddress
Source§impl Default for EnvelopeAddress
impl Default for EnvelopeAddress
Source§fn default() -> EnvelopeAddress
fn default() -> EnvelopeAddress
Source§impl From<&EnvelopeAddress> for Address
Converts an IMAP ENVELOPE address to a daaki_message::Address.
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
fn from(addr: &EnvelopeAddress) -> Self
Source§impl From<EnvelopeAddress> for Address
Owned conversion from IMAP envelope address to message address.
impl From<EnvelopeAddress> for Address
Owned conversion from IMAP envelope address to message address.