收件人规则集可将电子邮件放入动态s3存储桶中 [英] Recipient rule set to put emails into dynamic s3 bucket Amazon

查看:125
本文介绍了收件人规则集可将电子邮件放入动态s3存储桶中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置Amazon SES收件人规则集,以将电子邮件放入s3存储桶.我创建了一个s3存储桶,我希望根据电子邮件ID将这些邮件发送到文件夹中.例如,如果一封电子邮件要发送到 1@mydomain.com ,则应将其发送到 mytestbucket/1 ,如果该电子邮件发送到 2@mydomain.com strong>应该放入 mytestbucket/2 .

I am trying to set up amazon SES recipient rule set for putting emails into an s3 bucket. I have created an s3 bucket and I want these mails to sent into folders according to the email id. For example if an email is coming to 1@mydomain.com it should go into mytestbucket/1 and if it is coming to 2@mydomain.com it should go into mytestbucket/2.

    AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
    AmazonSimpleEmailServiceClient sesClient = new AmazonSimpleEmailServiceClient(awsCredentials);
    ;
    if (sesClient != null) {
        CreateReceiptRuleRequest req = new CreateReceiptRuleRequest();
        req.withRuleSetName(ruleSetName);
        ReceiptRule rule = new ReceiptRule();
        rule.setEnabled(true);
        rule.setName(customerIdString + "-email");
        rule.withRecipients(customerIdString + "@" + mydomain.com);
        List<ReceiptAction> actions = new ArrayList<ReceiptAction>();
        ReceiptAction action = new ReceiptAction();
        S3Action s3Action = new S3Action();
        s3Action.setBucketName(mytestbucket);
        s3Action.setObjectKeyPrefix(customerIdString);
        action.setS3Action(s3Action);
        actions.add(action);
        rule.setActions(actions);
        req.setRule(rule);
        CreateReceiptRuleResult response = sesClient.createReceiptRule(req);
        return true;
    }

每当我添加一个客户时,我都会调用此方法来为我的活动规则集创建规则.但是看来只能添加100条规则.我的用例至少要有10万个.我该如何实现?

Whenever I add a customer I was calling this method to create a rule to my active ruleset. But it looks like only 100 rules can be added. My usecase will be for at least 100 000. How can I achieve this?

我期望做的是

  1. 只有一个收件人规则,该规则规定任何进入mysubdomain的电子邮件都会调用lambda函数

  1. Have a single recipient rule which says any email comes to mysubdomain invoke a lambda function

Lambda函数应将电子邮件放入s3的子文件夹

Lambda function should put the email into subfolders of s3

推荐答案

按照以下步骤实现您想要的...

Follow these steps to achieve what you desire...

  1. 创建单个SES规则,以将所有电子邮件放入单个S3文件夹unsorted_emails(您可以将其命名).

  1. Create a single SES rule to place ALL emails into a single S3 folder unsorted_emails (you can call it anything).

创建一个Lambda函数,将电子邮件放入其适当的文件夹中.

Create a Lambda function that places emails into their proper folders.

unsorted_emails设置为触发lambda函数的事件源.

Set unsorted_emails as an event source to trigger your lambda function.

现在,每当将新电子邮件添加到unsorted_emails时,您的lambda函数将被触发并将电子邮件移动到适当的文件夹中.

Now, whenever new emails are added to unsorted_emails, your lambda function will be triggered and move the email into a proper folder.

让我知道这些步骤是否有意义,是否有任何疑问,或者我是否可以澄清更多.

Let me know if these steps make sense, if you have any questions, or if I can clarify more.

这篇关于收件人规则集可将电子邮件放入动态s3存储桶中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆