Skip to content

Change prod emails from mailchimp to SES#1651

Merged
jmhooper merged 1 commit intomasterfrom
jmhooper-switch-to-ses
Sep 14, 2017
Merged

Change prod emails from mailchimp to SES#1651
jmhooper merged 1 commit intomasterfrom
jmhooper-switch-to-ses

Conversation

@jmhooper
Copy link
Contributor

Why: It looks like we may need to move away from Mailchimp for
compliance reasons. SES is an email service we can buy from AWS to fill
the gap.

lib/aws/ses.rb Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need to provide any creds here since we can use AWS instance profiles.

With that in mind, we'll want to hold off on merging this until we have an issue resolved with devops to grant the necessary SES permissions to the IAM role associated with the EC2 instance profiles.

lib/aws/ses.rb Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. Too many .s

lib/aws/ses.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to make this def initialize(*); end to make the linters happy

lib/aws/ses.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on my reading of the API, destinations is not required? since the to, cc, etc are all in the raw mail body? http://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. For some reason I thought it was. Will fix

@jmhooper
Copy link
Contributor Author

@zachmargolis: Cleaned up a bit. PTAL

@jmhooper jmhooper force-pushed the jmhooper-switch-to-ses branch from 9fbfde5 to 4827506 Compare August 30, 2017 14:48
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (with the caveat we should test this in a lower env to make sure it's configured correctly before merging)

lib/aws/ses.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice trick to get around the reek complaint

@jmhooper
Copy link
Contributor Author

This is rebased and ready to be merged, but I have it marked Do not merge pending some devops changes to give the idp's instance profile the necessary SES permissions.

@jmhooper
Copy link
Contributor Author

jmhooper commented Sep 5, 2017

Switching this to WIP so we can make this configurable based on the environment.

@jmhooper
Copy link
Contributor Author

jmhooper commented Sep 11, 2017

@zachmargolis: I've modified the code in this PR so it only uses SES if the Mandrill API token is not present. Wanna take a look at that change?

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the new code (once the typo is addressed)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? is it missing a second L? :mandrill ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed it in a follow up commit

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@brodygov brodygov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for deploying this, we should be sure that https://github.com/18F/identity-devops/pull/603 is rolled out to each environment prior to switching over to SES.

lib/aws/ses.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to log a message here that we're instantiating a new SES client with the given region. Ran into errors in testing this because Figaro.env.aws_region was set to "not-used-yet".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/aws/ses.rb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to log some message when we're about to send an email and with some data about the response we get back. The current logs are super silent, which makes diagnosing problems difficult.

@jmhooper
Copy link
Contributor Author

jmhooper commented Sep 14, 2017

Since we have a feature flag, I'm going to go ahead and merge this since it won't have any affect effect until the Mandrill API key is removed.

**Why**: It looks like we may need to move away from Mailchimp for
compliance reasons. SES is an email service we can buy from AWS to fill
the gap.
@jmhooper jmhooper force-pushed the jmhooper-switch-to-ses branch from cdd41e3 to effdd71 Compare September 14, 2017 14:59
@jmhooper jmhooper merged commit 577cdf2 into master Sep 14, 2017
@jmhooper jmhooper deleted the jmhooper-switch-to-ses branch December 12, 2017 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants