configure mail?

53 views
Skip to first unread message

Thiebo

unread,
Apr 1, 2022, 12:06:17 PM4/1/22
to Rodauth
Hi,

How do I configure mail (in the rodauth dependencies) so emails get sent by smtp in production and maildev localhost in development? and configure emails with the correct link for confirmation?

Thanks,

Jeremy Evans

unread,
Apr 1, 2022, 12:19:05 PM4/1/22
to rod...@googlegroups.com
On Fri, Apr 1, 2022 at 9:06 AM Thiebo <thiebald...@gmail.com> wrote:
Hi,

How do I configure mail (in the rodauth dependencies) so emails get sent by smtp in production and maildev localhost in development? and configure emails with the correct link for confirmation?

Rodauth uses the mail gem to send email, so you configure the mail gem to do this.  Hadn't heard of maildev before, but it looks like a local SMTP server that just stores mail.  So you probably want something like:

case ENV['RACK_ENV']
when 'development'
  Mail.defaults do
    delivery_method :smtp, :address => "127.0.0.1", :port => 1025 # or whatever port maildev SMTP listens on
  end
when 'test'
  Mail.defaults do
    delivery_method :test # this allows you to check Mail::TestMailer.deliveries for received email in tests
  end
end

Thanks,
Jeremy
Reply all
Reply to author
Forward
0 new messages