pub struct MailSend {
    pub client: Client,
}

Fields

client: Client

Implementations

v3 Mail Send.

This function performs a POST to the /mail/send endpoint.

The Mail Send endpoint allows you to send email over SendGrid’s v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, see our v2 API Reference.

Helper Libraries

Twilio SendGrid provides libraries to help you quickly and easily integrate with the v3 Web API in 7 different languages:

Dynamic Transactional Templates and Handlebars

In order to send a dynamic template, specify the template ID with the template_id parameter.

To specify handlebar substitutions, define your substitutions in the request JSON with this syntax:

"dynamic_template_data": {
      "guest": "Jane Doe",
      "partysize": "4",
      "english": true,
      "date": "April 1st, 2021"
    }

For more information about Dynamic Transactional Templates and Handlebars, see our documentation and reference pages.

Mail body compression

Mail body compression is available to some high volume accounts. Talk to your CSM if you are interested in this functionality. Mail body compression works by setting up a JSON payload as defined on this page, then compressing it with gzip (the gzip file can be no more than 30mb).

To use mail body compression:

  1. Add a Content-Encoding header, with a value of gzip.
    a. Content-Encoding: gzip
  2. Send the gzip as a data-binary.
    a. --data-binary '@data.json.gz'

Trait Implementations

Send a plain text email.

This is a nicer experience than using post.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more