Email

Introduction

All email sent from your application is sent using the AWS Simple Email Service (SES).

Rather than configuring all app servers to send email, your VPC's Proxy instance acts as an SMTP relay.

Debugging

Is your app configured to go through the proxy?

If you're not receiving emails that you expect to send, the first step is to make sure that your Rails environment has the proper action mailer configuration setup.

If your staging environment's proxy is 10.37.18.85, you'll want config/environments/staging.rb to have the following configuration:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: URI.parse(ENV.fetch('HTTP_PROXY') { raise "HTTP_PROXY not set for mailer" }).host,
  enable_starttls_auto: false
}

Are you sending from an approved domain?

Before SES will send e-mails on your behalf, you must first verify an address.

The Weblinc Hosting team automatically verifies requests from your application's domain in Staging and QA environments, so you'll want to make sure the address you send from corresponds to your environment's name.

As an example, in staging, sending email from someaddress@exampleclient.com will not work, but someaddress@staging.exampleclient.weblinc.com will work.

In production, prior to launch, we will coordinate with your team to make sure that we can verify exampleclient.com or whatever address you'd like to send email from.

Is Sidekiq running?

Emails that aren't sent through the Rails console are queued with Sidekiq. If Sidekiq isn't running, your emails won't be sent.

Check if Sidekiq is running by executing ps aux | grep [s]idekiq.

Can you send test emails from the console?

You can test the sending of e-mails from a Rails console with the following snippet:

from_addr = "dummyaddress@staging.exampleclient.weblinc.com"
to_addr = "youremail@yourdomain.com"
message = "Does this work?"

ActionMailer::Base
  .mail(from: from_addr, to: to_addr, subject: message, body: message)
  .deliver