简体   繁体   中英

AWS SES auditing

I need to maintain the status in the database if the email was delivered successfully or not, if the user has actually received the email or not, when was the email delivered, email contents etc. for the purpose of auditing. How to do this ? Is there any API for this in AWS sdk ?

Its not as simple as just turning it on, but AWS does provide all the pieces you will need. This is how I do it currently

  1. Turn on AWS delivery notifications, which will send the notifications to an SNS topic
  2. Have that SNS topic delivery those messages to an SQS queue
  3. Have a background job processing those messages and move them to a DynamoDB database for permanent storage.

The key part is #1, how you handle #2 and #3 is up to you - if I had to do it again I would use Lambda to takeover #3 for me, instead of using a custom job running on a dedicated Ec2 instance.

You can find out more about delivery notifications here:

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/configure-sns-notifications.html#configure-feedback-notifications-console

also keep in mind, the tracking is not perfect - no email tracker is - SES uses some of the same techniques that mailchimp/constant contact use to determine if an email was opened, but it is far from foolproof.

You can configure Amazon SES to notify an Amazon SNS topic when you receive bounces or complaints, or when emails are delivered. Amazon SNS notifications are in JavaScript Object Notation (JSON) format, which enables you to process them programmatically.

Follow the steps :

  1. Create topic in SNS

  2. Subscribe to topic for delivery notifications(notifications are pushed to AWS SNS topic in JSON format).

  3. Subscribe to SNS in one of the following way:

    • Lambda
    • SQS
    • HTTP/S
    • Email
    • SMS

Considering the requirement of saving the JSON parameters in db table for purpose of auditing, you can listen to HTTP/S or SQS.

JSON response will have useful information like message id, notification type like complaints, bounce, delivery etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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