[−][src]Struct azure_functions::bindings::SendGridMessage
Represents the SendGrid email message output binding.
The following binding attributes are supported:
Name | Description |
---|---|
api_key | The name of an app setting that contains your API key. If not set, the default app setting name is "AzureWebJobsSendGridApiKey". |
to | The default recipient's email address. |
from | The default sender's email address. |
subject | The default subject of the email. |
text | The default email text content. |
Examples
use azure_functions::{ bindings::{HttpRequest, HttpResponse, SendGridMessage}, func, }; #[func] #[binding(name = "output1", from = "azure.functions.for.rust@example.com")] pub fn send_email(req: HttpRequest) -> (HttpResponse, SendGridMessage) { let params = req.query_params(); ( "The email was sent.".into(), SendGridMessage::build() .to(params.get("to").unwrap().as_str()) .subject(params.get("subject").unwrap().as_str()) .content(params.get("content").unwrap().as_str()) .finish(), ) }
Fields
from: Option<EmailAddress>
The email address of the sender. If None, the from
binding attribute is used.
subject: Option<String>
The subject of the email message. If None, the subject
binding attribute is used.
personalizations: Vec<Personalization>
The list of personalized messages and their metadata.
contents: Vec<Content>
The list of email content.
attachments: Vec<Attachment>
The list of email attachments.
template_id: Option<String>
The id of the SendGrid template to use.
headers: HashMap<String, String>
The map of key-value pairs of header names and the value to substitute for them.
sections: HashMap<String, String>
The map of key-value pairs that define large blocks of content that can be inserted into your emails using substitution tags.
categories: Vec<String>
The list of category names for this message.
custom_args: HashMap<String, String>
The map of key-value pairs that are specific to the entire send that will be carried along with the email and its activity data.
send_at: Option<i64>
The unix timestamp that specifies when the email should be sent from SendGrid.
unsubscribe_group: Option<UnsubscribeGroup>
The associated unsubscribe group that specifies how to handle unsubscribes.
batch_id: Option<String>
The id that represents a batch of emails to be associated to each other for scheduling.
ip_pool_name: Option<String>
The IP pool that the message should be sent from.
mail_settings: Option<MailSettings>
The settings that specify how the email message should be handled.
tracking_settings: Option<TrackingSettings>
The settings that specify how the email message should be tracked.
reply_to: Option<EmailAddress>
The email address and name of the individual who should receive responses to the email message.
Methods
impl SendGridMessage
[src]
pub fn build() -> MessageBuilder
[src]
Creates a new MessageBuilder for building a SendGrid message.
Examples
use azure_functions::bindings::SendGridMessage; let message = SendGridMessage::build() .to("foo@example.com") .subject("The subject of the message") .content("I hope this message finds you well.") .finish(); assert_eq!(message.personalizations[0].to[0].email, "foo@example.com"); assert_eq!(message.personalizations[0].subject, Some("The subject of the message".to_owned())); assert_eq!(message.contents[0].value, "I hope this message finds you well.");
Trait Implementations
impl Clone for SendGridMessage
[src]
fn clone(&self) -> SendGridMessage
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for SendGridMessage
[src]
fn default() -> SendGridMessage
[src]
impl Debug for SendGridMessage
[src]
impl Serialize for SendGridMessage
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for SendGridMessage
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for SendGridMessage
impl Sync for SendGridMessage
impl Unpin for SendGridMessage
impl UnwindSafe for SendGridMessage
impl RefUnwindSafe for SendGridMessage
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> IntoRequest<T> for T
[src]
fn into_request(self) -> Request<T>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,