pub struct Message {
pub content: Content,
pub to: Vec<Address>,
pub cc: Vec<Address>,
pub bcc: Vec<Address>,
pub reply_to: Option<Address>,
pub from: Option<Address>,
pub attachments: Vec<Attachment>,
}Expand description
A message to send. Built with Message::template or Message::raw
and the recipient methods; stored as JSON when queued.
Fields§
§content: Content§to: Vec<Address>§cc: Vec<Address>§bcc: Vec<Address>§reply_to: Option<Address>§from: Option<Address>A sender other than the configured one.
attachments: Vec<Attachment>Implementations§
Source§impl Message
impl Message
Sourcepub fn template(code: impl Into<String>, vars: impl Serialize) -> Self
pub fn template(code: impl Into<String>, vars: impl Serialize) -> Self
A message rendered from the template code with vars.
Sourcepub fn raw(
subject: impl Into<String>,
text: impl Into<String>,
html: Option<String>,
) -> Self
pub fn raw( subject: impl Into<String>, text: impl Into<String>, html: Option<String>, ) -> Self
A message with its own subject and text body; html optional.
Sourcepub fn to(self, address: &str) -> Self
pub fn to(self, address: &str) -> Self
Adds a recipient; text that is not an address is dropped.
pub fn cc(self, address: &str) -> Self
pub fn bcc(self, address: &str) -> Self
pub fn reply_to(self, address: &str) -> Self
pub fn from(self, address: &str) -> Self
pub fn attach( self, filename: impl Into<String>, content_type: impl Into<String>, bytes: Vec<u8>, ) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more