LoginSignup
1
1

More than 5 years have passed since last update.

AWSのSESでメールを受信してSNS経由でWEBサーバにHTTP(s)通信する

Posted at

前準備
・メール受信に必要なドメインのMXレコードを設定
・メールを保存するS3バケットを作成、ポリシーを設定しておく
ポリシーは以下に書いてます。
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowSESPuts",
            "Effect": "Allow",
            "Principal": {
                "Service": "ses.amazonaws.com"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::BUCKET-NAME/*",
            "Condition": {
                "StringEquals": {
                    "aws:Referer": "AWSACCOUNTID"
                }
            }
        }
    ]
}

SNSの設定
トピックを作成する

Subscriptionsで、HTTP通信したいURLを設定する

ARNを覚えておく

SESの設定
SESのEmail Receivingで受けるメアドを設定

AddActionでS3を選択
メールを保存するbucketを選択
SNS topicで、さっき作ったSNSを設定する

ここまでで手順は終わり。
メールテスト。
受けるメアドにメールを送信して、S3にメールが入る&サーバにアクセスが来ていたらOK。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1