Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29929

AWS SNS bounce notifications not being delivered

$
0
0

I have a Rails 4.2 app that's hosted on AWS that uses SES to deliver emails. I've set up SNS to POST notifications to the app when an email bounces. If I send a test email via the SES console, the endpoint associated with the SNS subscription gets hit by AWS exactly as expected with the bounce notification. When an email that gets sent from the application itself bounces, the endpoint is not hit, though there appears to be a corresponding bounce in the email statistics shown in the SES console.

If an email gets sent from the app with a Return-Path, the email associated with the return path does receive a "Delivery Status Notification (Failure)" message from the SES mailer daemon (though that email does go to spam). I have also checked the Apache access_log and error_log and only see the bounce notification endpoint hit when emails are sent via the SES console.

The emails within the app are sent via ActionMailer with a delivery_strategy of :aws_sdk (provided by the aws-sdk-rails gem). I have also tried using a delivery strategy of :smtp with email-smtp.us-east-1.amazonaws.com and the SES credentials--the only differences between the two strategies is that the :smtp strategy fails to follow the Return-Path. The Domain and email used in the "From" address are both verified with AWS, and DKIM is enabled, verified and appears to be working. The Bounce Notifications SNS Topic for the Domain is the correct one (and the topic's subscription has already been confirmed).

I've tested delivering emails to addresses with non-existent domains, non-existent addresses with real domains and bounce@simulator.amazonses.com. All tests with the app result in nothing being POSTed to the notification endpoint, and all tests with the SES console result in the expected behavior. All Amazon services use the same region (us-east-1), and all emails that are expected to be delivered without bouncing get delivered appropriately.

The code that delivers the mail looks essentially like this:

class SomeMailer < ApplicationMailer
  def some_email
    ...
    mail(
      to: destination,
      from: sender,
      cc: cc_addresses,
      subject: some_subject,
      template_name: some_template,
      return_path: return_path_email
    )
  end
end

I've tried taking out the return_path which has no effect on the SNS endpoint being hit.

I've done quite a bit of searching here and in the AWS docs and haven't found anything that changes this behavior. Any tips on how to get the bounce notifications delivered when being sent by the app would be greatly appreciated.


Viewing all articles
Browse latest Browse all 29929

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>