[][src]Struct sendgrid::Mail

pub struct Mail<'a> {
    pub to: Vec<Destination<'a>>,
    pub cc: Vec<&'a str>,
    pub bcc: Vec<&'a str>,
    pub from: &'a str,
    pub subject: &'a str,
    pub html: &'a str,
    pub text: &'a str,
    pub from_name: &'a str,
    pub reply_to: &'a str,
    pub date: &'a str,
    pub attachments: HashMap<String, String>,
    pub content: HashMap<String, &'a str>,
    pub headers: HashMap<String, &'a str>,
    pub x_smtpapi: &'a str,
}

This is a representation of a valid SendGrid message. It has support for all of the fields in the V2 API.

Fields

to: Vec<Destination<'a>>cc: Vec<&'a str>bcc: Vec<&'a str>from: &'a strsubject: &'a strhtml: &'a strtext: &'a strfrom_name: &'a strreply_to: &'a strdate: &'a strattachments: HashMap<String, String>content: HashMap<String, &'a str>headers: HashMap<String, &'a str>x_smtpapi: &'a str

Methods

impl<'a> Mail<'a>[src]

pub fn new() -> Mail<'a>[src]

Returns a new Mail struct to send with a client. All of the fields are initially empty.

pub fn add_cc(self, data: &'a str) -> Mail<'a>[src]

pub fn add_to(self, data: Destination<'a>) -> Mail<'a>[src]

pub fn add_from(self, data: &'a str) -> Mail<'a>[src]

pub fn add_subject(self, data: &'a str) -> Mail<'a>[src]

pub fn add_html(self, data: &'a str) -> Mail<'a>[src]

pub fn add_text(self, data: &'a str) -> Mail<'a>[src]

pub fn add_bcc(self, data: &'a str) -> Mail<'a>[src]

pub fn add_from_name(self, data: &'a str) -> Mail<'a>[src]

pub fn add_reply_to(self, data: &'a str) -> Mail<'a>[src]

pub fn add_date(self, data: &'a str) -> Mail<'a>[src]

pub fn build(self) -> Mail<'a>[src]

Convenience method when using Mail as a builder.

pub fn add_attachment<P: AsRef<Path>>(self, path: P) -> SendgridResult<Mail<'a>>[src]

Add an attachment for the message. You can pass the name of a file as a path on the file system.

Examples

This example is not tested
let message = Mail::new()
    .add_attachment("/path/to/file/contents.txt");

pub fn add_content(self, id: String, data: &'a str) -> Mail<'a>[src]

pub fn add_header(self, id: String, data: &'a str) -> Mail<'a>[src]

pub fn add_x_smtpapi(self, data: &'a str) -> Mail<'a>[src]

Trait Implementations

impl<'a> Debug for Mail<'a>[src]

impl<'a> Default for Mail<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Mail<'a>

impl<'a> Send for Mail<'a>

impl<'a> Sync for Mail<'a>

impl<'a> Unpin for Mail<'a>

impl<'a> UnwindSafe for Mail<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.