aws_sdk_pinpointemail/operation/send_email/
_send_email_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A request to send an email message.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SendEmailInput {
7    /// <p>The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.</p>
8    pub from_email_address: ::std::option::Option<::std::string::String>,
9    /// <p>An object that contains the recipients of the email message.</p>
10    pub destination: ::std::option::Option<crate::types::Destination>,
11    /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
12    pub reply_to_addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13    /// <p>The address that Amazon Pinpoint should send bounce and complaint notifications to.</p>
14    pub feedback_forwarding_email_address: ::std::option::Option<::std::string::String>,
15    /// <p>An object that contains the body of the message. You can send either a Simple message or a Raw message.</p>
16    pub content: ::std::option::Option<crate::types::EmailContent>,
17    /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
18    pub email_tags: ::std::option::Option<::std::vec::Vec<crate::types::MessageTag>>,
19    /// <p>The name of the configuration set that you want to use when sending the email.</p>
20    pub configuration_set_name: ::std::option::Option<::std::string::String>,
21}
22impl SendEmailInput {
23    /// <p>The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.</p>
24    pub fn from_email_address(&self) -> ::std::option::Option<&str> {
25        self.from_email_address.as_deref()
26    }
27    /// <p>An object that contains the recipients of the email message.</p>
28    pub fn destination(&self) -> ::std::option::Option<&crate::types::Destination> {
29        self.destination.as_ref()
30    }
31    /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
32    ///
33    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.reply_to_addresses.is_none()`.
34    pub fn reply_to_addresses(&self) -> &[::std::string::String] {
35        self.reply_to_addresses.as_deref().unwrap_or_default()
36    }
37    /// <p>The address that Amazon Pinpoint should send bounce and complaint notifications to.</p>
38    pub fn feedback_forwarding_email_address(&self) -> ::std::option::Option<&str> {
39        self.feedback_forwarding_email_address.as_deref()
40    }
41    /// <p>An object that contains the body of the message. You can send either a Simple message or a Raw message.</p>
42    pub fn content(&self) -> ::std::option::Option<&crate::types::EmailContent> {
43        self.content.as_ref()
44    }
45    /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
46    ///
47    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.email_tags.is_none()`.
48    pub fn email_tags(&self) -> &[crate::types::MessageTag] {
49        self.email_tags.as_deref().unwrap_or_default()
50    }
51    /// <p>The name of the configuration set that you want to use when sending the email.</p>
52    pub fn configuration_set_name(&self) -> ::std::option::Option<&str> {
53        self.configuration_set_name.as_deref()
54    }
55}
56impl SendEmailInput {
57    /// Creates a new builder-style object to manufacture [`SendEmailInput`](crate::operation::send_email::SendEmailInput).
58    pub fn builder() -> crate::operation::send_email::builders::SendEmailInputBuilder {
59        crate::operation::send_email::builders::SendEmailInputBuilder::default()
60    }
61}
62
63/// A builder for [`SendEmailInput`](crate::operation::send_email::SendEmailInput).
64#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
65#[non_exhaustive]
66pub struct SendEmailInputBuilder {
67    pub(crate) from_email_address: ::std::option::Option<::std::string::String>,
68    pub(crate) destination: ::std::option::Option<crate::types::Destination>,
69    pub(crate) reply_to_addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
70    pub(crate) feedback_forwarding_email_address: ::std::option::Option<::std::string::String>,
71    pub(crate) content: ::std::option::Option<crate::types::EmailContent>,
72    pub(crate) email_tags: ::std::option::Option<::std::vec::Vec<crate::types::MessageTag>>,
73    pub(crate) configuration_set_name: ::std::option::Option<::std::string::String>,
74}
75impl SendEmailInputBuilder {
76    /// <p>The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.</p>
77    pub fn from_email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.from_email_address = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.</p>
82    pub fn set_from_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.from_email_address = input;
84        self
85    }
86    /// <p>The email address that you want to use as the "From" address for the email. The address that you specify has to be verified.</p>
87    pub fn get_from_email_address(&self) -> &::std::option::Option<::std::string::String> {
88        &self.from_email_address
89    }
90    /// <p>An object that contains the recipients of the email message.</p>
91    /// This field is required.
92    pub fn destination(mut self, input: crate::types::Destination) -> Self {
93        self.destination = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>An object that contains the recipients of the email message.</p>
97    pub fn set_destination(mut self, input: ::std::option::Option<crate::types::Destination>) -> Self {
98        self.destination = input;
99        self
100    }
101    /// <p>An object that contains the recipients of the email message.</p>
102    pub fn get_destination(&self) -> &::std::option::Option<crate::types::Destination> {
103        &self.destination
104    }
105    /// Appends an item to `reply_to_addresses`.
106    ///
107    /// To override the contents of this collection use [`set_reply_to_addresses`](Self::set_reply_to_addresses).
108    ///
109    /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
110    pub fn reply_to_addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        let mut v = self.reply_to_addresses.unwrap_or_default();
112        v.push(input.into());
113        self.reply_to_addresses = ::std::option::Option::Some(v);
114        self
115    }
116    /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
117    pub fn set_reply_to_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
118        self.reply_to_addresses = input;
119        self
120    }
121    /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
122    pub fn get_reply_to_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
123        &self.reply_to_addresses
124    }
125    /// <p>The address that Amazon Pinpoint should send bounce and complaint notifications to.</p>
126    pub fn feedback_forwarding_email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.feedback_forwarding_email_address = ::std::option::Option::Some(input.into());
128        self
129    }
130    /// <p>The address that Amazon Pinpoint should send bounce and complaint notifications to.</p>
131    pub fn set_feedback_forwarding_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.feedback_forwarding_email_address = input;
133        self
134    }
135    /// <p>The address that Amazon Pinpoint should send bounce and complaint notifications to.</p>
136    pub fn get_feedback_forwarding_email_address(&self) -> &::std::option::Option<::std::string::String> {
137        &self.feedback_forwarding_email_address
138    }
139    /// <p>An object that contains the body of the message. You can send either a Simple message or a Raw message.</p>
140    /// This field is required.
141    pub fn content(mut self, input: crate::types::EmailContent) -> Self {
142        self.content = ::std::option::Option::Some(input);
143        self
144    }
145    /// <p>An object that contains the body of the message. You can send either a Simple message or a Raw message.</p>
146    pub fn set_content(mut self, input: ::std::option::Option<crate::types::EmailContent>) -> Self {
147        self.content = input;
148        self
149    }
150    /// <p>An object that contains the body of the message. You can send either a Simple message or a Raw message.</p>
151    pub fn get_content(&self) -> &::std::option::Option<crate::types::EmailContent> {
152        &self.content
153    }
154    /// Appends an item to `email_tags`.
155    ///
156    /// To override the contents of this collection use [`set_email_tags`](Self::set_email_tags).
157    ///
158    /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
159    pub fn email_tags(mut self, input: crate::types::MessageTag) -> Self {
160        let mut v = self.email_tags.unwrap_or_default();
161        v.push(input);
162        self.email_tags = ::std::option::Option::Some(v);
163        self
164    }
165    /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
166    pub fn set_email_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MessageTag>>) -> Self {
167        self.email_tags = input;
168        self
169    }
170    /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
171    pub fn get_email_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MessageTag>> {
172        &self.email_tags
173    }
174    /// <p>The name of the configuration set that you want to use when sending the email.</p>
175    pub fn configuration_set_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.configuration_set_name = ::std::option::Option::Some(input.into());
177        self
178    }
179    /// <p>The name of the configuration set that you want to use when sending the email.</p>
180    pub fn set_configuration_set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.configuration_set_name = input;
182        self
183    }
184    /// <p>The name of the configuration set that you want to use when sending the email.</p>
185    pub fn get_configuration_set_name(&self) -> &::std::option::Option<::std::string::String> {
186        &self.configuration_set_name
187    }
188    /// Consumes the builder and constructs a [`SendEmailInput`](crate::operation::send_email::SendEmailInput).
189    pub fn build(self) -> ::std::result::Result<crate::operation::send_email::SendEmailInput, ::aws_smithy_types::error::operation::BuildError> {
190        ::std::result::Result::Ok(crate::operation::send_email::SendEmailInput {
191            from_email_address: self.from_email_address,
192            destination: self.destination,
193            reply_to_addresses: self.reply_to_addresses,
194            feedback_forwarding_email_address: self.feedback_forwarding_email_address,
195            content: self.content,
196            email_tags: self.email_tags,
197            configuration_set_name: self.configuration_set_name,
198        })
199    }
200}