I have a contact us service which is triggered by users from a website.
Whenever user sends message, an email is sent to admin to notify about new contact. This email is in the form a json given below,
Is there a way to have it as a formatted email? I have figured out one method that is write a lambda to trigger SES. Is there a better method?
When SNS sends an email, it sends the entire notification and not just the message attribute.
You cannot format message or only send some of the attributes.
Your message is in JSON format, have you tried the subscription protocol "Email" instead of "Email-JSON"? It should give the same result but just in clear text. I dont know if that will help your situation.
An alternative would be to send the notifications to Lambda which can then send a formattet email via SES. You can either send the messages directly to Lambda, or via a SQS for resilience (see this discussion).
Related
I have a website with a email subscription form on it. I was wondering if it was possible to have the subscribe email button register the email that was submitted on my AWS SES account? Is it possible to just use an HTTP post to achieve this?
SES is an SMTP server for sending emails. It is not for the management of subscriptions or contact lists. Email addresses need to be stored and managed somewhere else, such as DynamoDB. If you are looking for an email delivery API that also manages contacts, look at something like SendGrid or Mailchimp.
The "email addresses" tab of SES is for Verified Sender identities, which are addresses that you will be sending email from. It is not for storing recipients.
You are trying to send an email to multiple subscribers using SES, but in your scenario you should probably be looking at SNS instead. You can use AWS SDK to add subscribers to an SNS topic using the subscribe function, and then simply call SNS publish to publish a message to that topic and it will send an email to all subscribers.
AWS Simple Email Service (SES): Bounce Email Notification/Feedback
I have both the following methods set up in the AWS Console to receive information about bounce emails:
1) Email Feedback forwarding - to send any bounce email details back to the sender. This is the domain or email that is managed in the AWS console and is verified. Hence the From/Source is a valid user email with a mailbox
2) SNS Notification for bounce emails - This is used to trigger a lambda function and the intention here is to get a notification on the emails that bounced and was sent from an address of a verified domain that doesn't have a mailbox e.g noreply#domain. This is automated from the software.
The lambda function forwards this notification to the reply emails that are part of the Header in the notification.
The reply emails may also contain personal email addresses that are not necessarily managed in the AWS console. Therefore the lambda is basically forwarding the notification back to all the reply emails of the user.
My issue here is that the above works but sometimes I get notifications using both methods.
Should AWS only choose one of the above two when dealing with bounces? Can someone please shed some light on this?
Thank you
Try creating a Deliverability dashboard, it now provides excel sheet to download and track your bounce emails.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/bouncecomplaintdashboard.html
The AWS documentation is not super clear with respect to simultaneously using multiple methods for bounce email notification. However, the following under 'Disabling Email Feedback Forwarding' does indicate that using more than one method for bounce notification will result in multiple notifications.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notifications-via-email.html
In my case (using the above two methods for bounce email notification), When I use the SES via SMTP interface from an Asp.Net app, I get two bounce email notifications, one via SNS and the other via the Email Feedback Forwarding method. In Addition when I use an email client like MSOutlook, then I only get one bounce notification which is expected
because it's not using SES.
My solution:
Option 1:
Use both methods for SES.
The Email Feedback Forwarding method will be responsible for delivering the notification to a verified email eg user#mycompany.com with a mailbox.
The lambda triggered by the SNS method will have a filter that will only process notifications where the source is norepy#mycompany.com.
Hence this will prevent duplicates and will also allow me to forward bounce email notifications to other reply-to emails (set by the web app in the header) that are not verified in my AWS.
Option 2:
Disable Email Feedback Forwarding Method and process all notifications via lambda triggered by SNS Method.
I am integrating SNS and Slack. I have created a slack app with incoming webhook enabled. I have got the webhook URL. I created a subscription for a SNS Topic with HTTPS protocol and set the Endpoint the webhookURL. Now the subscription is PendingConfirmation. I didnot receive any confirmation message, not in the destined channel.
How do I confirm the subscription?
You don't need to create a lambda function or create an HTTPS subscription with Slack.
On your slack channel, add the "email integration" app. Once done, Slack will provide you an email address with slack.com domain.
Emails sent to this address will be imported into your slack channel.
Then, on SNS create an email subscription and provide the slack email above.
The reason you're not seeing it in Slack is because the default JSON format for SNS messages doesn't conform to the format required by Slack:
You have two options for sending data to the Webhook URL above:
Send a JSON string as the payload parameter in a POST request
Send a JSON string as the body of a POST request
For a simple message, your JSON payload could contain a text property at minimum. This is the text that will be posted to the channel.
As another user suggested you can use an AWS Lambda function to facilitate this. There are free, public solutions available already, such as this one (which I did not author, and have not used...only including as a reference point).
You can confirm the subscription WITHOUT lambda. It is easy.
I found a way to integrate AWS SNS with slack WITHOUT AWS Lambda or AWS chatbot.
Follow the video which show all the step clearly.
https://www.youtube.com/watch?v=CszzQcPAqNM
Steps to follow:
Create slack channel or use existing channel
Create a work flow with selecting Webhook
Create a variable name as SubscribeURL. The name is very important
Add the above variable in the message body of the workflow
Publish the workflow and get the url
Add the above Url as subscription of the SNS
You will see the subscription URL in the slack channel
Follow the URl and complete the subscription
Come back to the work flow and change the variable to Message
The publish the message in SNS. you will see the message in the slack channel.
You have create a lambda function that receives SNS feedback and POST it to your webhook URL.
When you create a subscription to your lambda topic you choose AWS Lambda as protocol and select the lambda that you just created.
More info about it here: https://medium.com/cohealo-engineering/how-set-up-a-slack-channel-to-be-an-aws-sns-subscriber-63b4d57ad3ea
I might be late on this topic but you can configure AWS Chatbot (slack application) to send all the notifications to your slack.
More info here : https://aws.amazon.com/chatbot/
Is there a way to identify the originating email from a complaint notification in Amazon's SES? For example if we have 3 different mailing groups all sending different emails, and the recipient doesn't like 1 of them and reports it as spam, is there anything in the SES notification that would help us identify which email, and therefore which mailing group, we need to act on?
Yes, there is! From the docs:
Monitor your bounces and complaints and remove any bounced or
complained recipient addresses from your mailing list. You can be
notified of bounces and complaints in one of two ways: by email or by
Amazon Simple Notification Service (Amazon SNS) notifications. For
more information, see Monitoring Using Amazon SES Notifications.
Basically you can receive an email of a SNS notification (email, SMS, queue, etc.) to handle this. I would suggest SNS as it's way more flexible and the cost shouldn't be a problem (considering you don't have loads of complaints, of course!). Take a look:
Monitoring Using Amazon SES Notifications
EDIT: to identify the specific message the complaint is about, you'll need to store the unique ID created by SES when you send the message. From this AWS blog post:
Amazon SES assigns a unique message ID to each email that you
successfully submit to send. When Amazon SES receives a bounce or
complaint message from an ISP, we forward the feedback message to you.
I have used complaints treatment but never paid attention to this message ID. Anyway, looks like the path to follow.
Yes, you can do that
For each of the email that you send out via the SES, it gives back a messageID which is unique for every message that goes out (In your case it will be unique for each of the 3 mails that you send to the same recipient).
You need to persist that somewhere when you send emails.
Now when a complain occurs SES gives back the original messageId that this particular email was sent with.
And this way you can look up your local persistance and find out which of the 3 emails did the user complained for
I'm using Amazon SES to send email. I've also set up Amazon SNS to receive notifications when emails bounce for whatever reason. This is working fine.
In the bounce notification I receive, I can see the date, the sender and the recipient. But the subject of the mail is not listed. See example
I do see a messageId in there. Is there an API to retrieve the message details? I also looked at Amazon SQS, but I'm not sure if that will work.
You can't retrieve message details by messageID after the message has been sent, as there is no API call available to do so. You would need to store relevant details about the message along with the message ID given in the successful response from SES when sending the email (either through the API or SMTP). The Developer Guide covers a similar case of retrieving the recipients, which mentions that you would need to
store a mapping between [your own] identifier and the Amazon SES message ID that Amazon SES passes back to you when it accepts the email.
This answer by an Amazonian in an SES support thread (albeit from 2012) also reinforces that you'd need to record the message ID when you send the message.
if you record the message ID, you can use the message ID to identify the [e-mail message] that bounced or complained and then update the mailing list.