pub struct EncodableMail(_);
Expand description

a mail with all contained futures resolved, so that it can be encoded

Implementations

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.

A wrapper for encode which will create a buffer, enocde the mail and then returns the buffers content.

Methods from Deref<Target = Mail>

Returns true if the body of the mail is a multipart body.

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.

Returns a reference to the body/bodies.

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 (see HeaderMap’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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Converts this type into the (usually inferred) input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.