pub struct Email { /* private fields */ }
Implementations§
Source§impl Email
impl Email
Sourcepub fn new<F, D>(from: F, date: D) -> Result<Email, ParseError>
pub fn new<F, D>(from: F, date: D) -> Result<Email, ParseError>
Create a new email structure. The From
address and Date
fields are
required in all valid emails, thus you must pass these in.
Sourcepub fn set_date<D>(&mut self, date: D) -> Result<(), ParseError>
pub fn set_date<D>(&mut self, date: D) -> Result<(), ParseError>
Replace the Date
field in the email
Sourcepub fn set_from<F>(&mut self, from: F) -> Result<(), ParseError>
pub fn set_from<F>(&mut self, from: F) -> Result<(), ParseError>
Replace the From
field in the email
Sourcepub fn set_sender<S>(&mut self, sender: S) -> Result<(), ParseError>
pub fn set_sender<S>(&mut self, sender: S) -> Result<(), ParseError>
Set or replace the Sender
field in the email
Sourcepub fn get_sender(&self) -> Option<Sender>
pub fn get_sender(&self) -> Option<Sender>
Fetch the Sender
field from the email
Sourcepub fn clear_sender(&mut self)
pub fn clear_sender(&mut self)
Remove the Sender
field from the email
Sourcepub fn set_reply_to<R>(&mut self, reply_to: R) -> Result<(), ParseError>
pub fn set_reply_to<R>(&mut self, reply_to: R) -> Result<(), ParseError>
Set or replace the Reply-To
field in the email
Sourcepub fn get_reply_to(&self) -> Option<ReplyTo>
pub fn get_reply_to(&self) -> Option<ReplyTo>
Fetch the Reply-To
field from the email
Sourcepub fn clear_reply_to(&mut self)
pub fn clear_reply_to(&mut self)
Remove the Reply-To
field from the email
Sourcepub fn set_to<T>(&mut self, to: T) -> Result<(), ParseError>
pub fn set_to<T>(&mut self, to: T) -> Result<(), ParseError>
Set or replace the To
field in the email
Sourcepub fn set_cc<C>(&mut self, cc: C) -> Result<(), ParseError>
pub fn set_cc<C>(&mut self, cc: C) -> Result<(), ParseError>
Set or replace the Cc
field in the email
Sourcepub fn set_bcc<B>(&mut self, bcc: B) -> Result<(), ParseError>
pub fn set_bcc<B>(&mut self, bcc: B) -> Result<(), ParseError>
Set or replace the Bcc
field in the email
Sourcepub fn set_message_id<M>(&mut self, message_id: M) -> Result<(), ParseError>
pub fn set_message_id<M>(&mut self, message_id: M) -> Result<(), ParseError>
Set or replace the Message-ID
field in the email
Sourcepub fn get_message_id(&self) -> Option<MessageId>
pub fn get_message_id(&self) -> Option<MessageId>
Fetch the Message-ID
field from the email
Sourcepub fn clear_message_id(&mut self)
pub fn clear_message_id(&mut self)
Remove the Message-ID
field from the email
Sourcepub fn set_in_reply_to<I>(&mut self, in_reply_to: I) -> Result<(), ParseError>
pub fn set_in_reply_to<I>(&mut self, in_reply_to: I) -> Result<(), ParseError>
Set or replace the In-Reply-To
field in the email
Sourcepub fn get_in_reply_to(&self) -> Option<InReplyTo>
pub fn get_in_reply_to(&self) -> Option<InReplyTo>
Fetch the In-Reply-To
field from the email
Sourcepub fn clear_in_reply_to(&mut self)
pub fn clear_in_reply_to(&mut self)
Remove the In-Reply-To
field from the email
Sourcepub fn set_references<R>(&mut self, references: R) -> Result<(), ParseError>
pub fn set_references<R>(&mut self, references: R) -> Result<(), ParseError>
Set or replace the References
field in the email
Sourcepub fn get_references(&self) -> Option<References>
pub fn get_references(&self) -> Option<References>
Fetch the References
field from the email
Sourcepub fn clear_references(&mut self)
pub fn clear_references(&mut self)
Remove the References
field from the email
Sourcepub fn set_subject<S>(&mut self, subject: S) -> Result<(), ParseError>
pub fn set_subject<S>(&mut self, subject: S) -> Result<(), ParseError>
Set or replace the Subject
field in the email
Sourcepub fn get_subject(&self) -> Option<Subject>
pub fn get_subject(&self) -> Option<Subject>
Fetch the Subject
field from the email
Sourcepub fn clear_subject(&mut self)
pub fn clear_subject(&mut self)
Remove the Subject
field from the email
Sourcepub fn add_comments<C>(&mut self, comments: C) -> Result<(), ParseError>
pub fn add_comments<C>(&mut self, comments: C) -> Result<(), ParseError>
Add a Comments
field in the email. This may be in addition to
existing Comments
fields.
Sourcepub fn get_comments(&self) -> Vec<Comments>
pub fn get_comments(&self) -> Vec<Comments>
Fetch all Comments
fields from the email
Sourcepub fn clear_comments(&mut self)
pub fn clear_comments(&mut self)
Remove all Comments
fields from the email
Sourcepub fn add_keywords<K>(&mut self, keywords: K) -> Result<(), ParseError>
pub fn add_keywords<K>(&mut self, keywords: K) -> Result<(), ParseError>
Add a Keywords
field in the email. This may be in addition to existing
Keywords
fields.
Sourcepub fn get_keywords(&self) -> Vec<Keywords>
pub fn get_keywords(&self) -> Vec<Keywords>
Fetch all Keywords
fields from the email
Sourcepub fn clear_keywords(&mut self)
pub fn clear_keywords(&mut self)
Remove all Keywords
fields from the email
Sourcepub fn add_optional_field<O>(
&mut self,
optional_field: O,
) -> Result<(), ParseError>
pub fn add_optional_field<O>( &mut self, optional_field: O, ) -> Result<(), ParseError>
Add an optional field to the email. This may be in addition to existing optional fields.
Sourcepub fn get_optional_fields(&self) -> Vec<OptionalField>
pub fn get_optional_fields(&self) -> Vec<OptionalField>
Fetch all optional fields from the email
Sourcepub fn clear_optional_fields(&mut self)
pub fn clear_optional_fields(&mut self)
Clear all optional fields from the email
Sourcepub fn set_body<B>(&mut self, body: B) -> Result<(), ParseError>
pub fn set_body<B>(&mut self, body: B) -> Result<(), ParseError>
Set or replace the Body
in the email
Sourcepub fn clear_body(&mut self)
pub fn clear_body(&mut self)
Remove the Body
from the email, leaving an empty body