We've moved discussions to Discord

How to disable Letter Opener in development? [SOLVED]

Dan Weaver
I need to test file attachments in my emails. It seems I can't do this with Letter Opener.

I changed the default delivery method to SMTP but it's still using Letter Opener when I send emails.

# config/environments/development.rb

config.action_mailer.delivery_method = :smtp # :letter_opener_web

What else do I need to do?
Dan Weaver
Got it working. I assumed the SMTP credentials set up for production would be available in dev but in hindsight that was a dumb assumption.

All I had to do was add my SMTP settings to my dev config and to my dev credentials file.

Now I can switch between Mailgun and Letter Opener easily.

# config/environments/development.rb

# config.action_mailer.delivery_method = :letter_opener_web
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: 'smtp.mailgun.org',
  user_name: Rails.application.credentials.mailgun[:username],
  password: Rails.application.credentials.mailgun[:password]
}
Notifications
You’re not receiving notifications from this thread.