Skip to content
v2.273.0

EmailIdentity L2 construct ​

An email identity.

Example ​

ts
import * as iam from 'aws-cdk-lib/aws-iam';
declare const user: iam.User;

const identity = new ses.EmailIdentity(this, 'Identity', {
  identity: ses.Identity.domain('cdk.dev'),
});

identity.grantSendEmail(user);
python
import aws_cdk.aws_iam as iam
# user: iam.User


identity = ses.EmailIdentity(self, "Identity",
    identity=ses.Identity.domain("cdk.dev")
)

identity.grant_send_email(user)
java
import software.amazon.awscdk.services.iam.*;
User user;


EmailIdentity identity = EmailIdentity.Builder.create(this, "Identity")
        .identity(Identity.domain("cdk.dev"))
        .build();

identity.grantSendEmail(user);
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.IAM;
User user;


var identity = new EmailIdentity(this, "Identity", new EmailIdentityProps {
    Identity = Identity.Domain("cdk.dev")
});

identity.GrantSendEmail(user);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import iam "github.com/aws/aws-cdk-go/awscdk"
var user User


identity := ses.NewEmailIdentity(this, jsii.String("Identity"), &EmailIdentityProps{
	Identity: ses.Identity_Domain(jsii.String("cdk.dev")),
})

identity.grantSendEmail(user)

Initializer ​

ts
new EmailIdentity(scope: Construct, id: string, props: EmailIdentityProps)
python
EmailIdentity(scope: Construct, id: str, props: EmailIdentityProps)
java
new EmailIdentity(Construct scope, String id, EmailIdentityProps props)
csharp
new EmailIdentity(Construct scope, string id, EmailIdentityProps props)
go
NewEmailIdentity(Scope Construct, Id *string, Props EmailIdentityProps)

Construct Props ​

configurationSetIConfigurationSetRefconfiguration_setIConfigurationSetRefconfigurationSetIConfigurationSetRefConfigurationSetIConfigurationSetRefConfigurationSetIConfigurationSetRef= do not use a specific configurat…#
The configuration set to associate with the email identity.
default

Default: do not use a specific configuration set

dkimIdentityDkimIdentitydkim_identityDkimIdentitydkimIdentityDkimIdentityDkimIdentityDkimIdentityDkimIdentityDkimIdentity= Easy DKIM with a key length of 2…#
The type of DKIM identity to use.
default

Default: Easy DKIM with a key length of 2048-bit

dkimSigningbooleandkim_signingbooldkimSigningBooleanDkimSigningboolDkimSigning*bool= true#
Whether the messages that are sent from the identity are signed using DKIM.
feedbackForwardingbooleanfeedback_forwardingboolfeedbackForwardingBooleanFeedbackForwardingboolFeedbackForwarding*bool= true#
Whether to receive email notifications when bounce or complaint events occur.
notes

These notifications are sent to the address that you specified in the Return-Path header of the original email.

You're required to have a method of tracking bounces and complaints. If you haven't set up another mechanism for receiving bounce or complaint notifications (for example, by setting up an event destination), you receive an email notification when these events occur (even if this setting is disabled).

identityIdentityidentityIdentityidentityIdentityIdentityIdentityIdentityIdentityrequired#
The email address or domain to verify.
mailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailuremail_from_behavior_on_mx_failureMailFromBehaviorOnMxFailuremailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailureMailFromBehaviorOnMxFailure= MailFromBehaviorOnMxFailure.USE_…#
The action to take if the required MX record for the MAIL FROM domain isn't found when you send an email.
default

Default: MailFromBehaviorOnMxFailure.USE_DEFAULT_VALUE

mailFromDomainstringmail_from_domainstrmailFromDomainStringMailFromDomainstringMailFromDomain*string= use amazonses.com#
The custom MAIL FROM domain that you want the verified identity to use.
notes

The MAIL FROM domain must meet the following criteria:

  • It has to be a subdomain of the verified identity
  • It can't be used to receive email
  • It can't be used in a "From" address if the MAIL FROM domain is a destination for feedback forwarding emails

Properties ​

dkimDnsTokenName1stringdkim_dns_token_name1strdkimDnsTokenName1StringDkimDnsTokenName1stringDkimDnsTokenName1*stringrequired#
The host name for the first token that you have to add to the DNS configurationfor your domain.
dkimDnsTokenName2stringdkim_dns_token_name2strdkimDnsTokenName2StringDkimDnsTokenName2stringDkimDnsTokenName2*stringrequired#
The host name for the second token that you have to add to the DNS configuration for your domain.
dkimDnsTokenName3stringdkim_dns_token_name3strdkimDnsTokenName3StringDkimDnsTokenName3stringDkimDnsTokenName3*stringrequired#
The host name for the third token that you have to add to the DNS configuration for your domain.
dkimDnsTokenValue1stringdkim_dns_token_value1strdkimDnsTokenValue1StringDkimDnsTokenValue1stringDkimDnsTokenValue1*stringrequired#
The record value for the first token that you have to add to the DNS configuration for your domain.
dkimDnsTokenValue2stringdkim_dns_token_value2strdkimDnsTokenValue2StringDkimDnsTokenValue2stringDkimDnsTokenValue2*stringrequired#
The record value for the second token that you have to add to the DNS configuration for your domain.
dkimDnsTokenValue3stringdkim_dns_token_value3strdkimDnsTokenValue3StringDkimDnsTokenValue3stringDkimDnsTokenValue3*stringrequired#
The record value for the third token that you have to add to the DNS configuration for your domain.
dkimRecordsDkimRecord[]dkim_recordstyping.List[DkimRecord]dkimRecordsList<DkimRecord>DkimRecordsDkimRecord[]DkimRecords*[]DkimRecordrequired#
DKIM records for this identity.
emailIdentityArnstringemail_identity_arnstremailIdentityArnStringEmailIdentityArnstringEmailIdentityArn*stringrequired#
The ARN of the email identity.
emailIdentityNamestringemail_identity_namestremailIdentityNameStringEmailIdentityNamestringEmailIdentityName*stringrequired#
The name of the email identity.
emailIdentityRefEmailIdentityReferenceemail_identity_refEmailIdentityReferenceemailIdentityRefEmailIdentityReferenceEmailIdentityRefEmailIdentityReferenceEmailIdentityRefEmailIdentityReferencerequired#
A reference to a EmailIdentity resource.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

fromEmailIdentityArn(scope: Construct, id: string, emailIdentityArn: string): IEmailIdentity@staticmethod def from_email_identity_arn(scope: Construct, id: str, email_identity_arn: str) -> IEmailIdentitypublic static IEmailIdentity fromEmailIdentityArn(Construct scope, String id, String emailIdentityArn)public static IEmailIdentity FromEmailIdentityArn(Construct scope, string id, string emailIdentityArn)func FromEmailIdentityArn(Scope Construct, Id *string, EmailIdentityArn *string) IEmailIdentitystatic#
Import an email identity by ARN.
fromEmailIdentityName(scope: Construct, id: string, emailIdentityName: string): IEmailIdentity@staticmethod def from_email_identity_name(scope: Construct, id: str, email_identity_name: str) -> IEmailIdentitypublic static IEmailIdentity fromEmailIdentityName(Construct scope, String id, String emailIdentityName)public static IEmailIdentity FromEmailIdentityName(Construct scope, string id, string emailIdentityName)func FromEmailIdentityName(Scope Construct, Id *string, EmailIdentityName *string) IEmailIdentitystatic#
Use an existing email identity.
grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#
Adds an IAM policy statement associated with this email identity to an IAM principal's policy.

[disable-awslint:no-grants]

2 parameters

Parameters

  • granteegranteegranteegranteeGrantee — the principal (no-op if undefined).
  • actionsactionsactionsactionsActions — the set of actions to allow.
grantSendEmail(grantee: IGrantable): Grantdef grant_send_email(self, grantee: IGrantable) -> Grantpublic Grant grantSendEmail(IGrantable grantee)public Grant GrantSendEmail(IGrantable grantee)func GrantSendEmail(Grantee IGrantable) Grant#
Permits an IAM principal the send email action.

Actions: SendEmail, SendRawEmail.

[disable-awslint:no-grants]

1 parameter

Parameters

  • granteegranteegranteegranteeGrantee — the principal to grant access to.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.