pub struct SendEmail {
pub from: String,
pub to: Vec<String>,
pub cc: Vec<String>,
pub bcc: Vec<String>,
pub reply_to: Vec<String>,
pub subject: Option<String>,
pub html: Option<String>,
pub text: Option<String>,
pub attachments: Vec<Attachment>,
pub headers: HashMap<String, String>,
pub tags: HashMap<String, String>,
pub idempotency_key: Option<String>,
}Expand description
An outbound transactional email.
Build one with SendEmail::new and the builder helpers, then hand it to
crate::EmailClient::send. At least one of html or text is required;
from must be on the API key’s verified domain.
Fields§
§from: String§to: Vec<String>§cc: Vec<String>§bcc: Vec<String>§reply_to: Vec<String>§subject: Option<String>§html: Option<String>§text: Option<String>§attachments: Vec<Attachment>§headers: HashMap<String, String>§idempotency_key: Option<String>Implementations§
Source§impl SendEmail
impl SendEmail
Sourcepub fn new(
from: impl Into<String>,
to: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn new( from: impl Into<String>, to: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Start a message from a sender address and one or more recipients.
pub fn subject(self, subject: impl Into<String>) -> Self
pub fn html(self, html: impl Into<String>) -> Self
pub fn text(self, text: impl Into<String>) -> Self
pub fn cc(self, cc: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn bcc(self, bcc: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn reply_to( self, reply_to: impl IntoIterator<Item = impl Into<String>>, ) -> Self
pub fn attachment(self, attachment: Attachment) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
Sourcepub fn idempotency_key(self, key: impl Into<String>) -> Self
pub fn idempotency_key(self, key: impl Into<String>) -> Self
Make a retried send safe: the same key returns the original message instead of sending again.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SendEmail
impl<'de> Deserialize<'de> for SendEmail
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
Auto Trait Implementations§
impl Freeze for SendEmail
impl RefUnwindSafe for SendEmail
impl Send for SendEmail
impl Sync for SendEmail
impl Unpin for SendEmail
impl UnsafeUnpin for SendEmail
impl UnwindSafe for SendEmail
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