feat(builder): Add a content-type method
for SinglePart
This commit is contained in:
@@ -62,6 +62,12 @@ impl SinglePartBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the Content-Type header of the singlepart
|
||||||
|
pub fn content_type(mut self, content_type: ContentType) -> Self {
|
||||||
|
self.headers.set(content_type);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Build singlepart using body
|
/// Build singlepart using body
|
||||||
pub fn body<T: Into<Vec<u8>>>(self, body: T) -> SinglePart {
|
pub fn body<T: Into<Vec<u8>>>(self, body: T) -> SinglePart {
|
||||||
SinglePart {
|
SinglePart {
|
||||||
@@ -81,11 +87,8 @@ impl Default for SinglePartBuilder {
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```no_test
|
/// ```
|
||||||
/// extern crate mime;
|
/// use lettre::message::{SinglePart, header};
|
||||||
/// extern crate emailmessage;
|
|
||||||
///
|
|
||||||
/// use emailmessage::{SinglePart, header};
|
|
||||||
///
|
///
|
||||||
/// let part = SinglePart::builder()
|
/// let part = SinglePart::builder()
|
||||||
/// .header(header::ContentType("text/plain; charset=utf8".parse().unwrap()))
|
/// .header(header::ContentType("text/plain; charset=utf8".parse().unwrap()))
|
||||||
|
|||||||
Reference in New Issue
Block a user