Skip to content

Latest commit

 

History

History
177 lines (100 loc) · 10 KB

API.md

File metadata and controls

177 lines (100 loc) · 10 KB

API Reference

Classes

Name Description
EmailForwardingRule A construct to define an email forwarding rule that can either be used together with {@link EmailForwardingRuleSet} or as a standalone rule.
EmailForwardingRuleSet A construct for AWS SES to forward all emails of certain domains and email addresses to a list of target email addresses.

Structs

Name Description
EmailForwardingProps No description
EmailForwardingRuleProps No description
EmailForwardingRuleSetProps No description
EmailMapping No description

class EmailForwardingRule

A construct to define an email forwarding rule that can either be used together with {@link EmailForwardingRuleSet} or as a standalone rule.

It creates two rule actions:

  • One S3 action to save all incoming mails to an S3 bucket.
  • One Lambda action to forward all incoming mails to a list of configured emails.

The Lambda function is using the NPM package aws-lambda-ses-forwarder to forward the mails.

Implements: IConstruct, IDependable Extends: Construct

Initializer

new EmailForwardingRule(parent: Construct, name: string, props: EmailForwardingRuleProps)
  • parent (Construct) No description
  • name (string) No description
  • props (EmailForwardingRuleProps) No description
    • domainName (string) The domain name of the email addresses, e.g. 'example.org'. It is used to connect the fromPrefix and receivePrefix properties with a proper domain.
    • emailMapping (Array<EmailMapping>) An email mapping similar to what the NPM library aws-lambda-ses-forwarder expects.
    • fromPrefix (string) A prefix that is used as the sender address of the forwarded mail, e.g. noreply.
    • id (string) An id for the rule.
    • ruleSet (aws_ses.IReceiptRuleSet) The rule set this rule belongs to.
    • bucket (aws_s3.Bucket) A bucket to store the email files to. Default: A new bucket will be created.
    • bucketPrefix (string) A prefix for the email files that are saved to the bucket. Default: inbox/
    • enableLambdaLogging (boolean) Enable log messages in Lambda function which forwards emails. Default: true

class EmailForwardingRuleSet

A construct for AWS SES to forward all emails of certain domains and email addresses to a list of target email addresses.

It also verifies (or at least initiates verification of) the related domains and email addresses in SES.

The construct can be helpful if you don't want to host your own SMTP server but still want to receive emails to your existing email inbox. One use case is if you're just building some sort of landing page and want to quickly setup email receiving for your domain without yet another separate email inbox.

This construct can...

  • create a new receipt rule set (or use an existing one),
  • attach a list of rules to forward incoming emails to other target email addresses,
  • verify a given domain in SES (automatically if domain is managed by Route53, otherwise it'll just initiate the verification),
  • initiate verification for all target email addresses that are provided for receiving the forwarded emails.

Implements: IConstruct, IDependable Extends: Construct

Initializer

new EmailForwardingRuleSet(parent: Construct, name: string, props: EmailForwardingRuleSetProps)
  • parent (Construct) No description
  • name (string) No description
  • props (EmailForwardingRuleSetProps) No description
    • emailForwardingProps (Array<EmailForwardingProps>) A list of mapping options to define how emails should be forwarded.
    • enableRuleSet (boolean) Optional: whether to enable the rule set or not. Default: true
    • ruleSet (aws_ses.IReceiptRuleSet) Optional: an existing SES receipt rule set. Optional
    • ruleSetName (string) Optional: provide a name for the receipt rule set that this construct creates if you don't provide one. Default: custom-rule-set

Properties

Name Type Description
emailForwardingMappings Array
ruleSet aws_ses.IReceiptRuleSet

struct EmailForwardingProps

Name Type Description
domainName string The domain name for which you want to receive emails using SES, e.g. example.org.
emailMappings Array<EmailMapping> A list of email mappings to define the receive email address and target email addresses to which the emails are forwarded to.
fromPrefix string A prefix that is used as the sender address of the forwarded mail, e.g. noreply.
bucket? aws_s3.Bucket Optional: an S3 bucket to store the received emails.
Default: A new bucket.
bucketPrefix? string Optional: a prefix for the email files that are stored on the S3 bucket.
Default: inbox/
notificationTopic? aws_sns.Topic Optional: an SNS topic to receive notifications about sending events like bounces or complaints.
Default: A new SNS topic.
notificationTypes? Array Optional: a list of {@link NotificationType}s to define which sending events should be subscribed.
Default: ['Bounce', 'Complaint']
verifyDomain? boolean Optional: true if you want to verify the domain identity in SES, false otherwise.
Default: false
verifyTargetEmailAddresses? boolean Optional: true if you want to initiate the verification of your target email addresses, false otherwise.
Default: false

struct EmailForwardingRuleProps

Name Type Description
domainName string The domain name of the email addresses, e.g. 'example.org'. It is used to connect the fromPrefix and receivePrefix properties with a proper domain.
emailMapping Array<EmailMapping> An email mapping similar to what the NPM library aws-lambda-ses-forwarder expects.
fromPrefix string A prefix that is used as the sender address of the forwarded mail, e.g. noreply.
id string An id for the rule.
ruleSet aws_ses.IReceiptRuleSet The rule set this rule belongs to.
bucket? aws_s3.Bucket A bucket to store the email files to.
Default: A new bucket will be created.
bucketPrefix? string A prefix for the email files that are saved to the bucket.
Default: inbox/
enableLambdaLogging? boolean Enable log messages in Lambda function which forwards emails.
Default: true

struct EmailForwardingRuleSetProps

Name Type Description
emailForwardingProps Array<EmailForwardingProps> A list of mapping options to define how emails should be forwarded.
enableRuleSet? boolean Optional: whether to enable the rule set or not.
Default: true
ruleSet? aws_ses.IReceiptRuleSet Optional: an existing SES receipt rule set.
Optional
ruleSetName? string Optional: provide a name for the receipt rule set that this construct creates if you don't provide one.
Default: custom-rule-set

struct EmailMapping

Name Type Description
targetEmails Array A list of target email addresses that should receive the forwarded emails for the given email addresses matched by either receiveEmail or receivePrefix.
receiveEmail? string You can define a string that is matching an email address, e.g. [email protected]. To catch all emails, just use @ and your domain as the value, e.g. @example.org.
Optional
receivePrefix? string A short way to match a specific email addresses by only providing a prefix, e.g. hello. The prefix will be combined with the given domain name from {@link EmailForwardingRuleProps}. If an email was sent to this specific email address, all emails matching this receiver will be forwarded to all email addresses defined in targetEmails.
Optional