[−][src]Struct mail_core::EncodableMail
a mail with all contained futures resolved, so that it can be encoded
Methods
impl EncodableMail
[src]
pub fn encode(&self, encoder: &mut EncodingBuffer) -> Result<(), MailError>
[src]
Encode the mail using the given encoding buffer.
After encoding succeeded the buffer should contain a fully encoded mail including all attachments, embedded images alternate bodies etc.
Error
This can fail for a large number of reasons, e.g. some input can not be encoded with the given mail type or some headers/resources breack the mails hard line length limit.
pub fn encode_into_bytes(
&self,
mail_type: MailType
) -> Result<Vec<u8>, MailError>
[src]
&self,
mail_type: MailType
) -> Result<Vec<u8>, MailError>
A wrapper for encode
which will create a buffer, enocde the mail and then returns the buffers content.
Methods from Deref<Target = Mail>
pub fn has_multipart_body(&self) -> bool
[src]
Returns true if the body of the mail is a multipart body.
pub fn headers(&self) -> &HeaderMap
[src]
Returns a reference to the currently set headers.
Note that some headers namely Content-Transfer-Encoding
as well
as Content-Type
for singlepart mails are derived from the content
and should not be set. If done so they are either ignored or an
error is caused by them in other parts of the crate (like e.g. encoding).
Also Date
is auto-generated if not set and it is needed.
pub fn body(&self) -> &MailBody
[src]
Returns a reference to the body/bodies.
pub fn generally_validate_mail(&self) -> Result<(), MailError>
[src]
Validate the mail.
This will mainly validate the mail headers by
- checking if no ContentTransferHeader is given
- (for mails with multipart bodies) checking if the content type
is a
multipart
media type - (for mail with non-multipart bodies) check if there is no
content type header (as the content type header will be derived
from he
Resource
) - running all header validators (with
use_contextual_validators
) this also checks for "max one" consistency (seeHeaderMap
's documentation for more details) - doing this recursively with all contained mails
Note that this will be called by into_encodable_mail
, therefor
it is normally not required to call this function by yourself.
Be aware that this does a general validation applicable to both the
top level headers and headers from multipart mail sub bodies. This
means it e.g. doesn't check if there are any of the required headers
(Date
and From
).
Trait Implementations
impl Clone for EncodableMail
[src]
fn clone(&self) -> EncodableMail
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Into<Mail> for EncodableMail
[src]
impl Deref for EncodableMail
[src]
impl Debug for EncodableMail
[src]
Auto Trait Implementations
impl Send for EncodableMail
impl Sync for EncodableMail
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<F, T> HeaderTryInto for F where
T: HeaderTryFrom<F>,
[src]
T: HeaderTryFrom<F>,