pub struct EmailMessageBuilder { /* private fields */ }Available on crate feature
email only.Expand description
Builder for EmailMessage.
Implementations§
Source§impl EmailMessageBuilder
impl EmailMessageBuilder
Sourcepub fn subject<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn subject<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The subject of the email.
Sourcepub fn body<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn body<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The body content of the email.
Sourcepub fn cc(&mut self, value: Vec<Email>) -> &mut Self
pub fn cc(&mut self, value: Vec<Email>) -> &mut Self
The carbon copy (CC) recipients of the email.
Sourcepub fn bcc(&mut self, value: Vec<Email>) -> &mut Self
pub fn bcc(&mut self, value: Vec<Email>) -> &mut Self
The blind carbon copy (BCC) recipients of the email.
Sourcepub fn reply_to(&mut self, value: Vec<Email>) -> &mut Self
pub fn reply_to(&mut self, value: Vec<Email>) -> &mut Self
The reply-to addresses for the email.
Sourcepub fn attachments(&mut self, value: Vec<AttachmentData>) -> &mut Self
pub fn attachments(&mut self, value: Vec<AttachmentData>) -> &mut Self
Attachments to include with the email.
Source§impl EmailMessageBuilder
impl EmailMessageBuilder
Sourcepub fn build(&self) -> Result<EmailMessage, EmailMessageError>
pub fn build(&self) -> Result<EmailMessage, EmailMessageError>
Build the EmailMessage, ensuring required fields are set.
§Errors
This method returns an EmailMessageError if required fields are
missing.
§Examples
use cot::common_types::Email;
use cot::email::EmailMessage;
let message = EmailMessage::builder()
.from(Email::try_from("no-reply@example.com").unwrap())
.to(vec![Email::try_from("user@example.com").unwrap()])
.subject("Greetings")
.body("Hello from cot!")
.build()
.unwrap();Trait Implementations§
Source§impl Clone for EmailMessageBuilder
impl Clone for EmailMessageBuilder
Source§fn clone(&self) -> EmailMessageBuilder
fn clone(&self) -> EmailMessageBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EmailMessageBuilder
impl RefUnwindSafe for EmailMessageBuilder
impl Send for EmailMessageBuilder
impl Sync for EmailMessageBuilder
impl Unpin for EmailMessageBuilder
impl UnwindSafe for EmailMessageBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoField<Auto<T>> for T
impl<T> IntoField<Auto<T>> for T
Source§fn into_field(self) -> Auto<T>
fn into_field(self) -> Auto<T>
Available on crate feature
db only.Converts the type to the field type.