Example config for using Amazon SES from fly

I’m at the try-things-and-make-it-worse stage of debugging. I’m trying to use BambooSmtp to send emails via SES but I don’t really care what package I use. I’ve done it before, but that was a Heroku app that I don’t have access to any more - although this is pretty much the config from it. If someone has it working (with Bamboo or any other emailing package) please post your config so I can see what worked for you. Most recently I’ve gotten various errors related to SSL or SMTP but not any success yet - and its hard to figure out which part of the process is having trouble.

Here is my current (failing) config (I’ve toggled various values, but no success):

config :my_cool_app, MyCoolApp.Mailer,
       adapter: Bamboo.SMTPAdapter,
       server: "email-smtp.us-west-2.amazonaws.com",
       port: 587, # or 25, or 587,
       username: System.get_env("SMTP_USERNAME"),
       password: System.get_env("SMTP_PASSWORD"),
       tls: :if_available, # can be `:always`, ':if_available' or `:never`
       tls_verify: :verify_peer,
       auth: :always,
       ssl: false, # can be `true`
       retries: 1

Also, I did set up a cert for my app, using flyctl certs add my-cool-app.fly.dev but I have no idea what it actually did or where I can specify a cert file for DKIM.

tl;dr - if you have a working config/package, please post the config here and I’ll try it.

Locally it works with these values, and correctly sends the email:

tls_verify: :verify_none,
auth: :if_available,

Output is:

   from: {nil, "john.baylor@gmail.com"},
   to: [nil: "john.baylor@gmail.com"],
   cc: [],
   bcc: [],
   subject: "Welcome!",
   html_body: nil,
   text_body: "10:55 local test",
   headers: %{},
   attachments: [],
   assigns: %{},
   private: %{},
   blocked: false

but trying the exact same command from fly, I get:

** (CaseClauseError) no case clause matching: <<0>>
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:841: :gen_smtp_client.read_possible_multiline_reply/1
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:631: :gen_smtp_client.do_AUTH_each/5
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:556: :gen_smtp_client.try_AUTH/3
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:384: :gen_smtp_client.open_smtp_session/2
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:316: :gen_smtp_client.try_smtp_sessions/3
    (gen_smtp 1.2.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:289: :gen_smtp_client.send_it/2
    (bamboo_smtp 4.2.2) lib/bamboo/adapters/smtp_adapter.ex:87: Bamboo.SMTPAdapter.deliver/2
    (bamboo 2.2.0) lib/bamboo/mailer.ex:208: Bamboo.Mailer.deliver_now/4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.