Struct mail_core::EncodableMail
source · pub struct EncodableMail(_);
Expand description
a mail with all contained futures resolved, so that it can be encoded
Implementations
sourceimpl EncodableMail
impl EncodableMail
sourcepub fn encode(&self, encoder: &mut EncodingBuffer) -> Result<(), MailError>
pub fn encode(&self, encoder: &mut EncodingBuffer) -> Result<(), MailError>
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.
Methods from Deref<Target = Mail>
sourcepub fn has_multipart_body(&self) -> bool
pub fn has_multipart_body(&self) -> bool
Returns true if the body of the mail is a multipart body.
sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
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.
sourcepub fn generally_validate_mail(&self) -> Result<(), MailError>
pub fn generally_validate_mail(&self) -> Result<(), MailError>
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
sourceimpl Clone for EncodableMail
impl Clone for EncodableMail
sourcefn clone(&self) -> EncodableMail
fn clone(&self) -> EncodableMail
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more