pub struct Envelope {Show 16 fields
pub hash: EnvelopeHash,
pub date: String,
pub timestamp: u64,
pub from: SmallVec<[Address; 1]>,
pub to: SmallVec<[Address; 1]>,
pub cc: SmallVec<[Address; 1]>,
pub bcc: Vec<Address, Global>,
pub subject: Option<String>,
pub message_id: MessageID,
pub in_reply_to: Option<MessageID>,
pub references: Option<References>,
pub other_headers: HeaderMap,
pub thread: ThreadNodeHash,
pub flags: Flag,
pub has_attachments: bool,
pub tags: SmallVec<[TagHash; 8]>,
}
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§
§hash: EnvelopeHash
§date: String
§timestamp: u64
§from: SmallVec<[Address; 1]>
§to: SmallVec<[Address; 1]>
§cc: SmallVec<[Address; 1]>
§bcc: Vec<Address, Global>
§subject: Option<String>
§message_id: MessageID
§in_reply_to: Option<MessageID>
§references: Option<References>
§other_headers: HeaderMap
§thread: ThreadNodeHash
§flags: Flag
§has_attachments: bool
Implementations§
§impl Envelope
impl Envelope
pub fn new(hash: EnvelopeHash) -> Envelope
pub fn set_hash(&mut self, new_hash: EnvelopeHash) -> &mut Envelope
pub fn from_bytes(bytes: &[u8], flags: Option<Flag>) -> Result<Envelope, Error>
pub fn hash(&self) -> EnvelopeHash
pub fn populate_headers(&mut self, bytes: &[u8]) -> Result<(), Error>
pub fn date(&self) -> u64
pub fn datetime(&self) -> u64
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<(&'a str, &'a str), Global>, Error>
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 Envelope
pub fn set_bcc(&mut self, new_val: Vec<Address, Global>) -> &mut Envelope
pub fn set_cc(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Envelope
pub fn set_from(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Envelope
pub fn set_to(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Envelope
pub fn set_in_reply_to(&mut self, new_val: &[u8]) -> &mut Envelope
pub fn set_subject(&mut self, new_val: Vec<u8, Global>) -> &mut Envelope
pub fn set_message_id(&mut self, new_val: &[u8]) -> &mut Envelope
pub fn push_references(&mut self, new_ref: MessageID)
pub fn set_references(&mut self, new_val: &[u8]) -> &mut Envelope
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 Envelope
pub fn set_datetime(&mut self, new_val: u64) -> &mut Envelope
pub fn set_flag(&mut self, f: Flag, value: bool) -> &mut Envelope
pub fn set_flags(&mut self, f: Flag) -> &mut Envelope
pub fn flags(&self) -> Flag
pub fn set_seen(&mut self) -> &mut Envelope
pub fn set_unseen(&mut self) -> &mut Envelope
pub fn is_seen(&self) -> bool
pub fn set_has_attachments(&mut self, new_val: bool) -> &mut Envelope
pub fn has_attachments(&self) -> bool
Trait Implementations§
§impl<'de> Deserialize<'de> for Envelope
impl<'de> Deserialize<'de> for Envelope
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Envelope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Envelope, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Ord for Envelope
impl Ord for Envelope
§impl PartialOrd<Envelope> for Envelope
impl PartialOrd<Envelope> for Envelope
§fn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
fn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
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 more§impl Serialize for Envelope
impl Serialize for Envelope
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Envelope
Auto Trait Implementations§
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.