-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record the SES Message ID in the header :ses_message_id #25
Conversation
I actually like this plan. I'll timebox some time to brainstorm alternatives (say, tomorrow), and if I can't think of a better way, I'll merge and release this. I can't see a way that this would create problems, so I'm thinking I'm on board. |
test/aws/rails/mailer_test.rb
Outdated
assert_equal resp.context.params[:destinations], message.destinations | ||
data = @mailer.deliver!(message).context.params | ||
body = data[:raw_message][:data].to_s | ||
body.gsub!("\r\nHallo", "ses-message-id: #{message_id}\r\n\r\nHallo") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually like the test to mimic the behavior pattern you showed in the PR description. Perhaps retrieve the message body and message headers like a user would?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, that’s pushed.
test/test_helper.rb
Outdated
class TestMailer < ActionMailer::Base | ||
layout nil | ||
|
||
def deliverable(body:, from:, subject:, to:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use an 'opts' hash rather than keyword args here. We still maintain test compat with older Ruby versions, for customers with LTS of deprecated versions, in this library. Those tests are breaking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, that’s done.
Thank you! I'll release this sometime tomorrow. |
Released as version |
Following on from #10. Having the message ID is essential for tracking the deliverability (and other events).
Description of changes:
Instead of overriding
message_id
as was rejected in #10 I’ve placed the SES Message ID in a new header, so after you deliver a message through ActionMailer you have it available:This is adding the header after it’s sent only. I think it’s a reasonable conduit for passing this data back to the app in this instance.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.