Struct Email

Source
pub struct Email {
    pub from: EmailAddress,
    pub to: SmallVec<EmailAddress, 1>,
    pub reply_to: Option<SmallVec<EmailAddress, 1>>,
    pub cc: SmallVec<EmailAddress, 0>,
    pub bcc: SmallVec<EmailAddress, 0>,
    pub mkind: String,
    pub content: EmailContent,
}
Expand description

add an email to the offline email queue, so that the email can be sent later. these emails get picked up by the email worker.

§Arguments

  • from - EmailAddress
  • to - smallvec::SmallVec<EmailAddress, 1>
  • cc, bcc - smallvec::SmallVec<EmailAddress, 0>
  • mkind - mkind is any string, used for product analytics, etc. the value should be dotted, e.g., x.y.z to capture hierarchy. ideally you should use marketing. as the prefix for all marketing related emails, and anything else for transaction mails, so your mailer can use appropriate channels. /<app-url>/mail/<mkind>/ is the endpoint where the email content is fetched from.
  • content: EmailContent

Fields§

§from: EmailAddress§to: SmallVec<EmailAddress, 1>§reply_to: Option<SmallVec<EmailAddress, 1>>§cc: SmallVec<EmailAddress, 0>§bcc: SmallVec<EmailAddress, 0>§mkind: String§content: EmailContent

Implementations§

Source§

impl Email

Source

pub fn merge_context( &self, context: Option<Map<String, Value>>, ) -> Result<Map<String, Value>, Error>

Source§

impl Email

Source

pub fn new( from: EmailAddress, to: EmailAddress, mkind: &str, content: EmailContent, ) -> Email

Trait Implementations§

Source§

impl Clone for Email

Source§

fn clone(&self) -> Email

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Email

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Email

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Email, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Email

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Email

§

impl RefUnwindSafe for Email

§

impl Send for Email

§

impl Sync for Email

§

impl Unpin for Email

§

impl UnwindSafe for Email

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,