{"id":13505588,"url":"https://github.com/mkrn/cdk-ses-template-mailer","last_synced_at":"2025-03-30T00:31:14.106Z","repository":{"id":36886516,"uuid":"204962520","full_name":"mkrn/cdk-ses-template-mailer","owner":"mkrn","description":"AWS CDK Constructs to create SES templates and send templated emails","archived":false,"fork":false,"pushed_at":"2023-01-04T08:27:32.000Z","size":402,"stargazers_count":14,"open_issues_count":12,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T03:32:37.686Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkrn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-28T15:19:43.000Z","updated_at":"2023-08-23T05:39:48.000Z","dependencies_parsed_at":"2023-01-17T06:43:18.519Z","dependency_job_id":null,"html_url":"https://github.com/mkrn/cdk-ses-template-mailer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrn%2Fcdk-ses-template-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrn%2Fcdk-ses-template-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrn%2Fcdk-ses-template-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrn%2Fcdk-ses-template-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkrn","download_url":"https://codeload.github.com/mkrn/cdk-ses-template-mailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246262490,"owners_count":20749170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T00:01:10.221Z","updated_at":"2025-03-30T00:31:09.088Z","avatar_url":"https://github.com/mkrn.png","language":"TypeScript","funding_links":[],"categories":["Construct Libraries"],"sub_categories":["Queue"],"readme":"# UPDATE: DEPRECATED. USE https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ses.CfnTemplate.html \n\n## SES Templated Emails Helper Constructs for AWS CDK\n\n## Why \n- AWS SES Templates are amazing but pain to setup and manage\n\n## Features \n- Custom resource to create SES Email Templates (functionality missing in AWS UX and CloudFormation)\n- Custom resource to add SNS destination to message delivery events\n- SNS topic and optional email subscription to notify you of template render fails!\n- Lambda with an SQS queue to send emails without going over your SES limits\n- Easy to drop-in to your project and use right away\n- Perfect for transactional and drip emails \n- 0 idle costs. 100% serverless\n\n## SES Features\n- You can create up to 10,000 email templates per Amazon SES account.\n- Each template can be up to 500KB in size, including both the text and HTML parts.\n\n## Pre-requisites\n- FromEmail needs to be verified in AWS SES `aws ses verify-email-identity --email-address support@mydomain.com`\n- Apply for a sending limit increase (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html) to be able to send to non-verified email addresses\n- If you include `RenderFailuresNotificationsEmail` you will receive an \"AWS Notification - Subscription Confirmation\" email. \n- `npm install cdk-ses-template-mailer`\n\n## Use\n\n```\nimport { SESEmailTemplate, SESTemplateMailer } from 'cdk-ses-template-mailer';\n\n// Read from files\nnew SESEmailTemplate(this, 'Email1', {\n    TemplateName: 'mytemplate',\n    TextPart: fs.readFileSync(__dirname + '/../ses-templates/mytemplate/template.txt', 'utf8'),\n    HtmlPart: fs.readFileSync(__dirname + '/../ses-templates/mytemplate/template.html', 'utf8'),\n    SubjectPart: 'Email Subject Goes Here'\n});\n\n// Or embed\nnew SESEmailTemplate(this, 'EventLiveEmail', {\n    TemplateName: 'eventLive',\n    TextPart: 'Hi {{guest.name}}, {{data.event_title}} is Live!',\n    HtmlPart: '\u003cstrong\u003eHi {{guest.name}}\u003c/strong\u003e\u003cbr /\u003e{{data.event_title}} is Live!',\n    SubjectPart: '{{data.event_title}} is Live!'\n});\n\n// ... define more templates....\n\nconst mailer = new SESTemplateMailer(this, 'Mailer', {\n    FromEmail: 'support@mydomain.com',\n    FromName: 'My Service',\n    RenderFailuresNotificationsEmail: 'myemail@gmail.com' // optional. add your email to receive render failure notifications\n});\n\nnew cdk.CfnOutput(this, 'SQSQueueURL', {\n    value: mailer.queue.queueUrl\n})\n\nnew cdk.CfnOutput(this, 'SNSRenderFailureTopicArn', {\n    value: mailer.snsRenderFailuresTopic.topicArn\n})\n\n```\n\n## Adding SNS subscriptions to other email event types\n```\nimport { SESSNSDestination } from 'cdk-ses-template-mailer';\n\nconst newTopic = new sns.Topic(this, 'CustomEmailEventsTopic', {\n    topicName: 'sesSendConfigRenderFailures'\n});\n\nnew sns.Subscription(this, 'CustomEmailEventsTopicSubscription', {\n    topic: newTopic,\n    protocol: sns.SubscriptionProtocol.EMAIL,\n    endpoint: 'myemail@gmail.com'\n})\n\nnew SESSNSDestination(this, 'CustomEmailEventsTopicSNSDestination', {\n    ConfigurationSetName: 'SendConfig', // Keep it\n    EventDestinationName: 'CustomEventsSNSDestination',\n    MatchingEventTypes: [\n        'send' | 'reject' | 'bounce' | 'complaint' | 'delivery' | 'open' | 'click' | 'renderingFailure'\n    ],\n    TopicARN: newTopic.topicArn\n})\n```\n\n## SQS Message format\n```\nexport interface SESTemplateMailerEventBody {\n    to: {\n        name?: string,\n        email: string\n    },\n    data: any,\n    template: string // name of template\n}\n```\n\n## Test\n\n```\naws sqs send-message --queue-url=QUEUE_URL_FROM_OUTPUTS --message-body='{ \"data\": {}, \"template\": \"mytemplate\", \"to\": { \"email\": \"destination@gmail.com\", \"name\": \"Name\" }}'\n```\n\n## TODO \n- Explore SendBulkTemplatedEmail (send email to up to 50 destinations in each call)\n- Add automated email tracking and stats collection?\n- Export Message Type\n- Tests\n\n## Useful commands\n\n * `npm run build`   compile typescript to js\n * `npm run watch`   watch for changes and compile\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkrn%2Fcdk-ses-template-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkrn%2Fcdk-ses-template-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkrn%2Fcdk-ses-template-mailer/lists"}