pub struct Envelope {Show 16 fields
pub date: String,
pub subject: Option<String>,
pub from: SmallVec<[Address; 1]>,
pub to: SmallVec<[Address; 1]>,
pub cc: SmallVec<[Address; 1]>,
pub bcc: Vec<Address>,
pub in_reply_to: Option<MessageID>,
pub message_id: MessageID,
pub hash: EnvelopeHash,
pub timestamp: UnixTimestamp,
pub references: Option<References>,
pub other_headers: HeaderMap,
pub thread: ThreadNodeHash,
pub flags: Flag,
pub has_attachments: bool,
pub tags: IndexSet<TagHash>,
}
Expand description
Envelope
represents all the header and structure data of an email we need
to know.
Attachments (the email’s body) is parsed on demand with body
method.
To access the email attachments, you need to parse them from the raw email
bytes into an Attachment
object.
Fields§
§date: String
§subject: Option<String>
§from: SmallVec<[Address; 1]>
§to: SmallVec<[Address; 1]>
§cc: SmallVec<[Address; 1]>
§bcc: Vec<Address>
§in_reply_to: Option<MessageID>
§message_id: MessageID
§hash: EnvelopeHash
§timestamp: UnixTimestamp
§references: Option<References>
§other_headers: HeaderMap
§thread: ThreadNodeHash
§flags: Flag
§has_attachments: bool
Implementations§
source§impl Envelope
impl Envelope
pub fn new(hash: EnvelopeHash) -> Self
pub fn set_hash(&mut self, new_hash: EnvelopeHash) -> &mut Self
pub fn from_bytes(bytes: &[u8], flags: Option<Flag>) -> Result<Self>
pub fn hash(&self) -> EnvelopeHash
pub fn populate_headers(&mut self, bytes: &[u8]) -> Result<()>
pub fn date(&self) -> UnixTimestamp
pub fn datetime(&self) -> UnixTimestamp
pub fn date_as_str(&self) -> &str
pub fn from(&self) -> &[Address]
pub fn field_bcc_to_string(&self) -> String
pub fn field_cc_to_string(&self) -> String
pub fn field_from_to_string(&self) -> String
pub fn to(&self) -> &[Address]
pub fn cc(&self) -> &[Address]
pub fn bcc(&self) -> &[Address]
pub fn field_to_to_string(&self) -> String
pub fn field_references_to_string(&self) -> String
pub fn body_bytes(&self, bytes: &[u8]) -> Attachment
pub fn headers<'a>(&self, bytes: &'a [u8]) -> Result<Vec<(HeaderName, &'a str)>>
pub fn subject(&self) -> Cow<'_, str>
pub fn in_reply_to(&self) -> Option<&MessageID>
pub fn in_reply_to_display(&self) -> Option<Cow<'_, str>>
pub fn in_reply_to_raw(&self) -> Option<Cow<'_, str>>
pub fn message_id(&self) -> &MessageID
pub fn message_id_display(&self) -> Cow<'_, str>
pub fn message_id_raw(&self) -> Cow<'_, str>
pub fn set_date(&mut self, new_val: &[u8]) -> &mut Self
pub fn set_bcc(&mut self, new_val: Vec<Address>) -> &mut Self
pub fn set_cc(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self
pub fn set_from(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self
pub fn set_to(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self
pub fn set_in_reply_to(&mut self, new_val: &[u8]) -> &mut Self
pub fn set_subject(&mut self, new_val: Vec<u8>) -> &mut Self
pub fn set_message_id(&mut self, new_val: &[u8]) -> &mut Self
pub fn push_references(&mut self, new_ref: MessageID)
pub fn set_references(&mut self, new_val: &[u8]) -> &mut Self
pub fn references(&self) -> SmallVec<[&MessageID; 8]>
pub fn other_headers(&self) -> &HeaderMap
pub fn other_headers_mut(&mut self) -> &mut HeaderMap
pub fn thread(&self) -> ThreadNodeHash
pub fn set_thread(&mut self, new_val: ThreadNodeHash) -> &mut Self
pub fn set_datetime(&mut self, new_val: UnixTimestamp) -> &mut Self
pub fn set_flag(&mut self, f: Flag, value: bool) -> &mut Self
pub fn set_flags(&mut self, f: Flag) -> &mut Self
pub fn flags(&self) -> Flag
pub fn set_seen(&mut self) -> &mut Self
pub fn set_unseen(&mut self) -> &mut Self
pub fn is_seen(&self) -> bool
pub fn set_has_attachments(&mut self, new_val: bool) -> &mut Self
pub fn has_attachments(&self) -> bool
Trait Implementations§
source§impl<'de> Deserialize<'de> for Envelope
impl<'de> Deserialize<'de> for Envelope
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Envelope
impl Ord for Envelope
source§impl PartialEq for Envelope
impl PartialEq for Envelope
source§impl PartialOrd for Envelope
impl PartialOrd for Envelope
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Envelope
Auto Trait Implementations§
impl Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.