sendOutboundEmail method
- required EmailAddressInfo destinationEmailAddress,
- required OutboundEmailContent emailMessage,
- required EmailAddressInfo fromEmailAddress,
- required String instanceId,
- required TrafficType trafficType,
- OutboundAdditionalRecipients? additionalRecipients,
- String? clientToken,
- SourceCampaign? sourceCampaign,
Send outbound email for outbound campaigns. For more information about outbound campaigns, see Set up Connect Customer outbound campaigns.
May throw AccessDeniedException.
May throw IdempotencyException.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
Parameter destinationEmailAddress :
The email address to send the email to.
Parameter emailMessage :
The email message body to be sent to the newly created email.
Parameter fromEmailAddress :
The email address to be used for sending email.
Parameter instanceId :
The identifier of the Connect Customer instance. You can find
the instance ID in the Amazon Resource Name (ARN) of the instance.
Parameter trafficType :
Denotes the class of traffic.
Parameter additionalRecipients :
The additional recipients address of the email in CC.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If not provided, the Amazon Web Services SDK
populates this field. For more information about idempotency, see Making
retries safe with idempotent APIs.
Parameter sourceCampaign :
A Campaign object need for Campaign traffic type.
Implementation
Future<void> sendOutboundEmail({
required EmailAddressInfo destinationEmailAddress,
required OutboundEmailContent emailMessage,
required EmailAddressInfo fromEmailAddress,
required String instanceId,
required TrafficType trafficType,
OutboundAdditionalRecipients? additionalRecipients,
String? clientToken,
SourceCampaign? sourceCampaign,
}) async {
final $payload = <String, dynamic>{
'DestinationEmailAddress': destinationEmailAddress,
'EmailMessage': emailMessage,
'FromEmailAddress': fromEmailAddress,
'TrafficType': trafficType.value,
if (additionalRecipients != null)
'AdditionalRecipients': additionalRecipients,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (sourceCampaign != null) 'SourceCampaign': sourceCampaign,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/instance/${Uri.encodeComponent(instanceId)}/outbound-email',
exceptionFnMap: _exceptionFns,
);
}