简体   繁体   English

从 docker 容器(Spring Boot 应用程序)托管的 Amazon AWS ECS 集群以编程方式发送电子邮件的最佳方式?

[英]Best way to send e-mail programmatically from docker container (Spring Boot app) hosted Amazon AWS ECS Cluster?

I was wondering if anyone could advise the "best" (I know that's subjective, but meaning "best" as in least amount of work/steps) to trigger sending an E-mail from Amazon AWS.我想知道是否有人可以建议“最佳”(我知道这是主观的,但意味着“最佳”的工作/步骤量最少)以触发从 Amazon AWS 发送电子邮件。 The Message body with contain dynamic variables/data from my App (Spring boot) so I will have to wire that in somehow, and it should be triggered from within my Application whenever it finishes processing some data, since my app reads .CSV data.消息正文包含来自我的应用程序(Spring 启动)的动态变量/数据,因此我必须以某种方式连接它,并且在完成处理某些数据时应该从我的应用程序内部触发它,因为我的应用程序读取 .CSV 数据。

  1. I cannot use JavaMail/Jakarta to send e-mail from within app as all Containers I have have blocked ports我无法使用 JavaMail/Jakarta 从应用程序内发送电子邮件,因为我已阻止端口的所有容器
  2. Preferably using some type of AWS service since I'm already hosting this app on AWS ECS cluster最好使用某种类型的 AWS 服务,因为我已经在 AWS ECS 集群上托管了这个应用程序

I would like to do it programmatically:我想以编程方式进行: 在此处输入图片说明

AWS provides Amazon Simple Email Service (SES) which is: AWS 提供Amazon Simple Email Service (SES) ,它是:

is an email platform that provides an easy , cost-effective way for you to send and receive email using your own email addresses and domains.是一个电子邮件平台,它为您提供了一种简单、经济高效的方式来使用您自己的电子邮件地址和域发送和接收电子邮件。

To use that, you would add SES permissions to your ECS tasks role .要使用它,您需要向ECS 任务角色添加 SES 权限。 This way, you don't need to hard-code any AWS credentials into your application, as they will be automatically obtained by AWS SDK when interacting with SES.这样,您无需将任何 AWS 凭证硬编码到您的应用程序中,因为它们会在与 SES 交互时由 AWS 开发工具包自动获取。

AWS also provides AWS SDK for java . AWS 还提供AWS SDK for java Using the SDK you can send emails using SES as shown in the example Send an email using the AWS SDK for Java .使用开发工具包,您可以使用 SES 发送电子邮件,如示例使用适用于 Java 的 AWS 开发工具包发送电子邮件中所示。

If you want to send an email from a Spring Boot app, then use the Simple Email Service Java V2 API.如果要从 Spring Boot 应用程序发送电子邮件,请使用 Simple Email Service Java V2 API。 There is an AWS Java V2 tutorial that shows how to build a Spring BOOT app that uses various AWS Services to analyze photos located in an Amazon S3 bucket.一个 AWS Java V2 教程展示了如何构建一个 Spring BOOT 应用程序,该应用程序使用各种 AWS 服务来分析位于 Amazon S3 存储桶中的照片。 This app uses the SES Java V2 API to send a report that contains the details of the Amazon Rekognition service that analyzes the photos.此应用程序使用 SES Java V2 API 发送报告,其中包含分析照片的 Amazon Rekognition 服务的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 连接到 AWS ECS 上不同 docker 容器中的 spring-boot 应用程序的错误请求 - Bad Request Connecting to a spring-boot app in a different docker container on AWS ECS 在AWS ECS集群中显示Docker容器日志 - Showing docker container log in aws ECS cluster AWS - SES 不发送电子邮件 - 子网 - AWS - SES Not send e-mail - SUBNET 如何使用Tomcat托管的Spring Boot应用程序从Docker Container通过JDBC访问Oracle AWS RDS - How to access Oracle AWS RDS through JDBC from Docker Container with Spring boot application hosted on Tomcat 为适用于 Android 的 Amazon AWS SES 发送带附件的电子邮件? - Sending E-mail with Attachment for Amazon AWS SES for Android? 如何以编程方式扩展 AWS ECS 上托管的 Docker 容器? - How to scale Docker containers hosted on AWS ECS programmatically? 从托管在 aws 上的 Flask 应用程序发送确认邮件 - Send Confirmation Mail from Flask App that is hosted on aws AWS ECS集群未显示容器 - AWS ECS cluster is not showing container 如何在 AWS 上托管的 docker 容器内使用 spring 引导加载 static 文件? - How to load static files with spring boot inside a docker container hosted on AWS? 使用 Amazon Linux 2 为使用 AWS Elastic Beanstalk 托管的 Java Spring Boot 应用程序添加 SSL 证书 - Add SSL certificate for Java Spring Boot App hosted using AWS Elastic Beanstalk using Amazon Linux 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM