简体   繁体   English

使用AWS SES / SNS接收电子邮件

[英]Recieving emails with AWS SES/SNS

I am trying to a create email to in app message in a rails app that I am building. 我正在尝试在我正在构建的rails应用程序中的应用程序消息中创建电子邮件。 I am using SES to receive inbound emails and then send them to my rails app with SNS where I am trying to process them. 我正在使用SES接收入站电子邮件,然后使用SNS将它们发送到我的rails应用程序,我正在尝试处理它们。

I can see in my production logs that SNS is hitting my endpoint but SNS is not sending any json with the request. 我可以在我的生产日志中看到SNS正在访问我的端点,但SNS没有发送任何带有请求的json。 I have no idea how to even begin debugging this. 我不知道如何开始调试这个。

These are the params that SNS is sending to POST "/email_processor" 这些是SNS发送到POST "/email_processor"

Processing by EmailsController#recieved as HTML

 <ActionController::Parameters {"controller"=>"emails", "action"=>"recieved"} permitted: false>

Instead of using SNS, configure to trigger a Lambda function upon receiving an email. 而不是使用SNS,配置为在收到电子邮件时触发Lambda函数。 Then using the Lambda function you can call your rails backend with required parameters of the mail. 然后使用Lambda函数,您可以使用所需的邮件参数调用rails后端。

由于电子邮件可能很大,您可以配置SES然后将其保存到S3存储桶,而S3存储桶又可用于触发lambda函数或在Ruby中创建延迟作业,以便在完成工作时读取和删除文件!

I figured out a solution for this but I have no idea why it works. 我想出了一个解决方案,但我不知道为什么它的工作原理。 I have SES trigger and SNS which triggers lambda which sends the email to my endpoint. 我有SES触发器和SNS触发lambda,它将电子邮件发送到我的端点。 I have no idea why SNS is not sending any json with its request to my endpoint. 我不知道为什么SNS没有向我的端点发送任何带有请求的json。 SNS does send the full json payload to lambda. SNS确实将完整的json有效负载发送到lambda。 I'm not happy with this work around but it works. 我对这项工作不满意,但它有效。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM