Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Last active January 25, 2022 20:24
Show Gist options
  • Select an option

  • Save chrisroos/6b32b07aefa010526f7e5cfe58d61978 to your computer and use it in GitHub Desktop.

Select an option

Save chrisroos/6b32b07aefa010526f7e5cfe58d61978 to your computer and use it in GitHub Desktop.

I added two verified email addresses to SES so that I could send emails from/to them while in the SES Sandbox.

UserMailer

class UserMailer < ApplicationMailer
  default from: 'accounts+aws-ses@gofreerange.com'

  def welcome_email
    mail(to: 'chris.roos@gofreerange.com', subject: 'Welcome to My Awesome Site')
  end
end

Using ActionMailer config from CoTech Cobudget ('Enable Start TLS Auto', 'SSL' and 'TLS')

This results in an SSL error.

config.action_mailer.smtp_settings = {
  address: 'email-smtp.eu-west-1.amazonaws.com',
  port:	25,
  enable_starttls_auto: true,
  tls: true,
  ssl: true,
  user_name: '<username>',
  password: '<password>'
}
$ rails c
> UserMailer.with({}).welcome_email.deliver_now
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

Using 'Enable Start TLS Auto' and 'TLS'

This results in an SSL error.

config.action_mailer.smtp_settings = {
  address: 'email-smtp.eu-west-1.amazonaws.com',
  port:	25,
  enable_starttls_auto: true,
  tls: true,
  user_name: '<username>',
  password: '<password>'
}
$ rails c
> UserMailer.with({}).welcome_email.deliver_now
> OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

Using 'Enable Start TLS Auto' and 'SSL'

This results in an SSL error.

config.action_mailer.smtp_settings = {
  address: 'email-smtp.eu-west-1.amazonaws.com',
  port:	25,
  enable_starttls_auto: true,
  ssl: true,
  user_name: '<username>',
  password: '<password>'
}
$ rails c
> UserMailer.with({}).welcome_email.deliver_now
> OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

Using 'Enable Start TLS Auto'

This works correctly. And presumably encrypts the traffic.

config.action_mailer.smtp_settings = {
  address: 'email-smtp.eu-west-1.amazonaws.com',
  port:	25,
  enable_starttls_auto: true,
  user_name: '<username>',
  password: '<password>'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment