All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ses.model.SendRawEmailRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SES module holds the client classes that are used for communicating with Amazon Simple Email Service

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.ses.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents a request to send a single raw email using Amazon SES. For more information, see the Amazon SES Developer Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SendRawEmailRequest extends SesRequest implements ToCopyableBuilder { private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Source") .getter(getter(SendRawEmailRequest::source)).setter(setter(Builder::source)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build(); private static final SdkField> DESTINATIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Destinations") .getter(getter(SendRawEmailRequest::destinations)) .setter(setter(Builder::destinations)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Destinations").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField RAW_MESSAGE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("RawMessage").getter(getter(SendRawEmailRequest::rawMessage)).setter(setter(Builder::rawMessage)) .constructor(RawMessage::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RawMessage").build()).build(); private static final SdkField FROM_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FromArn").getter(getter(SendRawEmailRequest::fromArn)).setter(setter(Builder::fromArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FromArn").build()).build(); private static final SdkField SOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourceArn").getter(getter(SendRawEmailRequest::sourceArn)).setter(setter(Builder::sourceArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceArn").build()).build(); private static final SdkField RETURN_PATH_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ReturnPathArn").getter(getter(SendRawEmailRequest::returnPathArn)) .setter(setter(Builder::returnPathArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnPathArn").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(SendRawEmailRequest::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(MessageTag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CONFIGURATION_SET_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConfigurationSetName").getter(getter(SendRawEmailRequest::configurationSetName)) .setter(setter(Builder::configurationSetName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConfigurationSetName").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SOURCE_FIELD, DESTINATIONS_FIELD, RAW_MESSAGE_FIELD, FROM_ARN_FIELD, SOURCE_ARN_FIELD, RETURN_PATH_ARN_FIELD, TAGS_FIELD, CONFIGURATION_SET_NAME_FIELD)); private final String source; private final List destinations; private final RawMessage rawMessage; private final String fromArn; private final String sourceArn; private final String returnPathArn; private final List tags; private final String configurationSetName; private SendRawEmailRequest(BuilderImpl builder) { super(builder); this.source = builder.source; this.destinations = builder.destinations; this.rawMessage = builder.rawMessage; this.fromArn = builder.fromArn; this.sourceArn = builder.sourceArn; this.returnPathArn = builder.returnPathArn; this.tags = builder.tags; this.configurationSetName = builder.configurationSetName; } /** *

* The identity's email address. If you do not provide a value for this parameter, you must specify a "From" address * in the raw text of the message. (You can also specify both.) *

* *

* Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a source email * address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the domain * part of an address (the part after the @ sign) contains non-ASCII characters, they must be encoded using * Punycode, as described in RFC3492. The sender name (also * known as the friendly name) may contain non-ASCII characters. These characters must be encoded using MIME * encoded-word syntax, as described in RFC 2047. MIME * encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. *

*
*

* If you specify the Source parameter and have feedback forwarding enabled, then bounces and * complaints will be sent to this email address. This takes precedence over any Return-Path header that you might * include in the raw text of the message. *

* * @return The identity's email address. If you do not provide a value for this parameter, you must specify a "From" * address in the raw text of the message. (You can also specify both.)

*

* Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a * source email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the * domain part of an address (the part after the @ sign) contains non-ASCII characters, they must be * encoded using Punycode, as described in RFC3492. * The sender name (also known as the friendly name) may contain non-ASCII characters. These * characters must be encoded using MIME encoded-word syntax, as described in RFC 2047. MIME encoded-word syntax uses the following * form: =?charset?encoding?encoded-text?=. *

*
*

* If you specify the Source parameter and have feedback forwarding enabled, then bounces and * complaints will be sent to this email address. This takes precedence over any Return-Path header that you * might include in the raw text of the message. */ public String source() { return source; } /** * Returns true if the Destinations property was specified by the sender (it may be empty), or false if the sender * did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasDestinations() { return destinations != null && !(destinations instanceof SdkAutoConstructList); } /** *

* A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasDestinations()} to see if a value was sent in this field. *

* * @return A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. */ public List destinations() { return destinations; } /** *

* The raw email message itself. The message has to meet the following criteria: *

*
    *
  • *

    * The message has to contain a header and a body, separated by a blank line. *

    *
  • *
  • *

    * All of the required header fields must be present in the message. *

    *
  • *
  • *

    * Each part of a multipart MIME message must be formatted properly. *

    *
  • *
  • *

    * Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see Unsupported Attachment Types in * the Amazon SES Developer Guide. *

    *
  • *
  • *

    * The entire message must be base64-encoded. *

    *
  • *
  • *

    * If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, we * highly recommend that you encode that content. For more information, see Sending Raw Email in the * Amazon SES Developer Guide. *

    *
  • *
  • *

    * Per RFC 5321, the maximum length of each line * of text, including the <CRLF>, must not exceed 1,000 characters. *

    *
  • *
* * @return The raw email message itself. The message has to meet the following criteria:

*
    *
  • *

    * The message has to contain a header and a body, separated by a blank line. *

    *
  • *
  • *

    * All of the required header fields must be present in the message. *

    *
  • *
  • *

    * Each part of a multipart MIME message must be formatted properly. *

    *
  • *
  • *

    * Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, * see Unsupported * Attachment Types in the Amazon SES Developer Guide. *

    *
  • *
  • *

    * The entire message must be base64-encoded. *

    *
  • *
  • *

    * If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character * range, we highly recommend that you encode that content. For more information, see Sending Raw Email in * the Amazon SES Developer Guide. *

    *
  • *
  • *

    * Per RFC 5321, the maximum length of * each line of text, including the <CRLF>, must not exceed 1,000 characters. *

    *
  • */ public RawMessage rawMessage() { return rawMessage; } /** *

    * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the * sending authorization policy that permits you to specify a particular "From" address in the header of the raw * email. *

    *

    * Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of the * email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses the * value of the FromArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in this guide, * or see the Amazon SES Developer Guide. *

    *
    * * @return This parameter is used only for sending authorization. It is the ARN of the identity that is associated * with the sending authorization policy that permits you to specify a particular "From" address in the * header of the raw email.

    *

    * Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message * of the email. If you use both the FromArn parameter and the corresponding X-header, Amazon * SES uses the value of the FromArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

    */ public String fromArn() { return fromArn; } /** *

    * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the * sending authorization policy that permits you to send for the email address specified in the Source * parameter. *

    *

    * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you * to send from [email protected], then you would specify the SourceArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be * [email protected]. *

    *

    * Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of the * email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES uses the * value of the SourceArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in this guide, * or see the Amazon SES Developer Guide. *

    *
    * * @return This parameter is used only for sending authorization. It is the ARN of the identity that is associated * with the sending authorization policy that permits you to send for the email address specified in the * Source parameter.

    *

    * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that * authorizes you to send from [email protected], then you would specify the * SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and * the Source to be [email protected]. *

    *

    * Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw * message of the email. If you use both the SourceArn parameter and the corresponding * X-header, Amazon SES uses the value of the SourceArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

    */ public String sourceArn() { return sourceArn; } /** *

    * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the * sending authorization policy that permits you to use the email address specified in the ReturnPath * parameter. *

    *

    * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you * to use [email protected], then you would specify the ReturnPathArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be * [email protected]. *

    *

    * Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw message * of the email. If you use both the ReturnPathArn parameter and the corresponding X-header, Amazon SES * uses the value of the ReturnPathArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in this guide, * or see the Amazon SES Developer Guide. *

    *
    * * @return This parameter is used only for sending authorization. It is the ARN of the identity that is associated * with the sending authorization policy that permits you to use the email address specified in the * ReturnPath parameter.

    *

    * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that * authorizes you to use [email protected], then you would specify the * ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, * and the ReturnPath to be [email protected]. *

    *

    * Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw * message of the email. If you use both the ReturnPathArn parameter and the corresponding * X-header, Amazon SES uses the value of the ReturnPathArn parameter. *

    * *

    * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

    */ public String returnPathArn() { return returnPathArn; } /** * Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

    * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can * publish email sending events. *

    *

    * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

    *

    * You can use {@link #hasTags()} to see if a value was sent in this field. *

    * * @return A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that you * can publish email sending events. */ public List tags() { return tags; } /** *

    * The name of the configuration set to use when you send an email using SendRawEmail. *

    * * @return The name of the configuration set to use when you send an email using SendRawEmail. */ public String configurationSetName() { return configurationSetName; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(source()); hashCode = 31 * hashCode + Objects.hashCode(hasDestinations() ? destinations() : null); hashCode = 31 * hashCode + Objects.hashCode(rawMessage()); hashCode = 31 * hashCode + Objects.hashCode(fromArn()); hashCode = 31 * hashCode + Objects.hashCode(sourceArn()); hashCode = 31 * hashCode + Objects.hashCode(returnPathArn()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(configurationSetName()); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SendRawEmailRequest)) { return false; } SendRawEmailRequest other = (SendRawEmailRequest) obj; return Objects.equals(source(), other.source()) && hasDestinations() == other.hasDestinations() && Objects.equals(destinations(), other.destinations()) && Objects.equals(rawMessage(), other.rawMessage()) && Objects.equals(fromArn(), other.fromArn()) && Objects.equals(sourceArn(), other.sourceArn()) && Objects.equals(returnPathArn(), other.returnPathArn()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(configurationSetName(), other.configurationSetName()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("SendRawEmailRequest").add("Source", source()) .add("Destinations", hasDestinations() ? destinations() : null).add("RawMessage", rawMessage()) .add("FromArn", fromArn()).add("SourceArn", sourceArn()).add("ReturnPathArn", returnPathArn()) .add("Tags", hasTags() ? tags() : null).add("ConfigurationSetName", configurationSetName()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Source": return Optional.ofNullable(clazz.cast(source())); case "Destinations": return Optional.ofNullable(clazz.cast(destinations())); case "RawMessage": return Optional.ofNullable(clazz.cast(rawMessage())); case "FromArn": return Optional.ofNullable(clazz.cast(fromArn())); case "SourceArn": return Optional.ofNullable(clazz.cast(sourceArn())); case "ReturnPathArn": return Optional.ofNullable(clazz.cast(returnPathArn())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "ConfigurationSetName": return Optional.ofNullable(clazz.cast(configurationSetName())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SendRawEmailRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SesRequest.Builder, SdkPojo, CopyableBuilder { /** *

    * The identity's email address. If you do not provide a value for this parameter, you must specify a "From" * address in the raw text of the message. (You can also specify both.) *

    * *

    * Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a source * email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the domain * part of an address (the part after the @ sign) contains non-ASCII characters, they must be encoded using * Punycode, as described in RFC3492. The sender name * (also known as the friendly name) may contain non-ASCII characters. These characters must be encoded * using MIME encoded-word syntax, as described in RFC 2047. * MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. *

    *
    *

    * If you specify the Source parameter and have feedback forwarding enabled, then bounces and * complaints will be sent to this email address. This takes precedence over any Return-Path header that you * might include in the raw text of the message. *

    * * @param source * The identity's email address. If you do not provide a value for this parameter, you must specify a * "From" address in the raw text of the message. (You can also specify both.)

    *

    * Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a * source email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the * domain part of an address (the part after the @ sign) contains non-ASCII characters, they must * be encoded using Punycode, as described in RFC3492. The sender name (also known as the * friendly name) may contain non-ASCII characters. These characters must be encoded using MIME * encoded-word syntax, as described in RFC 2047. MIME * encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. *

    *
    *

    * If you specify the Source parameter and have feedback forwarding enabled, then bounces * and complaints will be sent to this email address. This takes precedence over any Return-Path header * that you might include in the raw text of the message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder source(String source); /** *

    * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. *

    * * @param destinations * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinations(Collection destinations); /** *

    * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. *

    * * @param destinations * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses. * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinations(String... destinations); /** *

    * The raw email message itself. The message has to meet the following criteria: *

    *
      *
    • *

      * The message has to contain a header and a body, separated by a blank line. *

      *
    • *
    • *

      * All of the required header fields must be present in the message. *

      *
    • *
    • *

      * Each part of a multipart MIME message must be formatted properly. *

      *
    • *
    • *

      * Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see * Unsupported Attachment * Types in the Amazon SES Developer Guide. *

      *
    • *
    • *

      * The entire message must be base64-encoded. *

      *
    • *
    • *

      * If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, * we highly recommend that you encode that content. For more information, see Sending Raw Email in the * Amazon SES Developer Guide. *

      *
    • *
    • *

      * Per RFC 5321, the maximum length of each * line of text, including the <CRLF>, must not exceed 1,000 characters. *

      *
    • *
    * * @param rawMessage * The raw email message itself. The message has to meet the following criteria:

    *
      *
    • *

      * The message has to contain a header and a body, separated by a blank line. *

      *
    • *
    • *

      * All of the required header fields must be present in the message. *

      *
    • *
    • *

      * Each part of a multipart MIME message must be formatted properly. *

      *
    • *
    • *

      * Attachments must be of a content type that Amazon SES supports. For a list on unsupported content * types, see Unsupported * Attachment Types in the Amazon SES Developer Guide. *

      *
    • *
    • *

      * The entire message must be base64-encoded. *

      *
    • *
    • *

      * If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character * range, we highly recommend that you encode that content. For more information, see Sending Raw Email * in the Amazon SES Developer Guide. *

      *
    • *
    • *

      * Per RFC 5321, the maximum length * of each line of text, including the <CRLF>, must not exceed 1,000 characters. *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder rawMessage(RawMessage rawMessage); /** *

      * The raw email message itself. The message has to meet the following criteria: *

      *
        *
      • *

        * The message has to contain a header and a body, separated by a blank line. *

        *
      • *
      • *

        * All of the required header fields must be present in the message. *

        *
      • *
      • *

        * Each part of a multipart MIME message must be formatted properly. *

        *
      • *
      • *

        * Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see * Unsupported Attachment * Types in the Amazon SES Developer Guide. *

        *
      • *
      • *

        * The entire message must be base64-encoded. *

        *
      • *
      • *

        * If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, * we highly recommend that you encode that content. For more information, see Sending Raw Email in the * Amazon SES Developer Guide. *

        *
      • *
      • *

        * Per RFC 5321, the maximum length of each * line of text, including the <CRLF>, must not exceed 1,000 characters. *

        *
      • *
      * This is a convenience that creates an instance of the {@link RawMessage.Builder} avoiding the need to create * one manually via {@link RawMessage#builder()}. * * When the {@link Consumer} completes, {@link RawMessage.Builder#build()} is called immediately and its result * is passed to {@link #rawMessage(RawMessage)}. * * @param rawMessage * a consumer that will call methods on {@link RawMessage.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #rawMessage(RawMessage) */ default Builder rawMessage(Consumer rawMessage) { return rawMessage(RawMessage.builder().applyMutation(rawMessage).build()); } /** *

      * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with * the sending authorization policy that permits you to specify a particular "From" address in the header of the * raw email. *

      *

      * Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of * the email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses * the value of the FromArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in this * guide, or see the Amazon SES Developer Guide. *

      *
      * * @param fromArn * This parameter is used only for sending authorization. It is the ARN of the identity that is * associated with the sending authorization policy that permits you to specify a particular "From" * address in the header of the raw email.

      *

      * Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw * message of the email. If you use both the FromArn parameter and the corresponding * X-header, Amazon SES uses the value of the FromArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

      * @return Returns a reference to this object so that method calls can be chained together. */ Builder fromArn(String fromArn); /** *

      * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with * the sending authorization policy that permits you to send for the email address specified in the * Source parameter. *

      *

      * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes * you to send from [email protected], then you would specify the SourceArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be * [email protected]. *

      *

      * Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of * the email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES * uses the value of the SourceArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in this * guide, or see the Amazon SES Developer Guide. *

      *
      * * @param sourceArn * This parameter is used only for sending authorization. It is the ARN of the identity that is * associated with the sending authorization policy that permits you to send for the email address * specified in the Source parameter.

      *

      * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that * authorizes you to send from [email protected], then you would specify the * SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and * the Source to be [email protected]. *

      *

      * Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw * message of the email. If you use both the SourceArn parameter and the corresponding * X-header, Amazon SES uses the value of the SourceArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

      * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceArn(String sourceArn); /** *

      * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with * the sending authorization policy that permits you to use the email address specified in the * ReturnPath parameter. *

      *

      * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes * you to use [email protected], then you would specify the ReturnPathArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be * [email protected]. *

      *

      * Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw * message of the email. If you use both the ReturnPathArn parameter and the corresponding * X-header, Amazon SES uses the value of the ReturnPathArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in this * guide, or see the Amazon SES Developer Guide. *

      *
      * * @param returnPathArn * This parameter is used only for sending authorization. It is the ARN of the identity that is * associated with the sending authorization policy that permits you to use the email address specified * in the ReturnPath parameter.

      *

      * For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that * authorizes you to use [email protected], then you would specify the * ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, * and the ReturnPath to be [email protected]. *

      *

      * Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the * raw message of the email. If you use both the ReturnPathArn parameter and the * corresponding X-header, Amazon SES uses the value of the ReturnPathArn parameter. *

      * *

      * For information about when to use this parameter, see the description of SendRawEmail in * this guide, or see the Amazon SES Developer Guide. *

      * @return Returns a reference to this object so that method calls can be chained together. */ Builder returnPathArn(String returnPathArn); /** *

      * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can * publish email sending events. *

      * * @param tags * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that * you can publish email sending events. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

      * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can * publish email sending events. *

      * * @param tags * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that * you can publish email sending events. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(MessageTag... tags); /** *

      * A list of tags, in the form of name/value pairs, to apply to an email that you send using * SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can * publish email sending events. *

      * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); /** *

      * The name of the configuration set to use when you send an email using SendRawEmail. *

      * * @param configurationSetName * The name of the configuration set to use when you send an email using SendRawEmail. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configurationSetName(String configurationSetName); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SesRequest.BuilderImpl implements Builder { private String source; private List destinations = DefaultSdkAutoConstructList.getInstance(); private RawMessage rawMessage; private String fromArn; private String sourceArn; private String returnPathArn; private List tags = DefaultSdkAutoConstructList.getInstance(); private String configurationSetName; private BuilderImpl() { } private BuilderImpl(SendRawEmailRequest model) { super(model); source(model.source); destinations(model.destinations); rawMessage(model.rawMessage); fromArn(model.fromArn); sourceArn(model.sourceArn); returnPathArn(model.returnPathArn); tags(model.tags); configurationSetName(model.configurationSetName); } public final String getSource() { return source; } @Override public final Builder source(String source) { this.source = source; return this; } public final void setSource(String source) { this.source = source; } public final Collection getDestinations() { if (destinations instanceof SdkAutoConstructList) { return null; } return destinations; } @Override public final Builder destinations(Collection destinations) { this.destinations = AddressListCopier.copy(destinations); return this; } @Override @SafeVarargs public final Builder destinations(String... destinations) { destinations(Arrays.asList(destinations)); return this; } public final void setDestinations(Collection destinations) { this.destinations = AddressListCopier.copy(destinations); } public final RawMessage.Builder getRawMessage() { return rawMessage != null ? rawMessage.toBuilder() : null; } @Override public final Builder rawMessage(RawMessage rawMessage) { this.rawMessage = rawMessage; return this; } public final void setRawMessage(RawMessage.BuilderImpl rawMessage) { this.rawMessage = rawMessage != null ? rawMessage.build() : null; } public final String getFromArn() { return fromArn; } @Override public final Builder fromArn(String fromArn) { this.fromArn = fromArn; return this; } public final void setFromArn(String fromArn) { this.fromArn = fromArn; } public final String getSourceArn() { return sourceArn; } @Override public final Builder sourceArn(String sourceArn) { this.sourceArn = sourceArn; return this; } public final void setSourceArn(String sourceArn) { this.sourceArn = sourceArn; } public final String getReturnPathArn() { return returnPathArn; } @Override public final Builder returnPathArn(String returnPathArn) { this.returnPathArn = returnPathArn; return this; } public final void setReturnPathArn(String returnPathArn) { this.returnPathArn = returnPathArn; } public final Collection getTags() { if (tags instanceof SdkAutoConstructList) { return null; } return tags != null ? tags.stream().map(MessageTag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = MessageTagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(MessageTag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> MessageTag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = MessageTagListCopier.copyFromBuilder(tags); } public final String getConfigurationSetName() { return configurationSetName; } @Override public final Builder configurationSetName(String configurationSetName) { this.configurationSetName = configurationSetName; return this; } public final void setConfigurationSetName(String configurationSetName) { this.configurationSetName = configurationSetName; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public SendRawEmailRequest build() { return new SendRawEmailRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy