summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-09-18 20:36:54 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-09-18 20:36:54 +0200
commita02505f996b02a4313c9e266b88fbe7b844fb8da (patch)
tree766d961d7592236980038e95ea857870b353018d
parent2adf6c09c4697fb23abff3e6548e2fdb73f328f6 (diff)
downloadnorsk-urskog-registrations-a02505f996b02a4313c9e266b88fbe7b844fb8da.tar.gz
norsk-urskog-registrations-a02505f996b02a4313c9e266b88fbe7b844fb8da.tar.bz2
norsk-urskog-registrations-a02505f996b02a4313c9e266b88fbe7b844fb8da.zip
Convert hash keys to symbols for mail delivery settings.
-rw-r--r--lib/registration.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/registration.rb b/lib/registration.rb
index b82cdb4..6fc4b9a 100644
--- a/lib/registration.rb
+++ b/lib/registration.rb
@@ -12,7 +12,14 @@ def send_registration_emails_for(band, pdf_url)
mail.body = erb :registration_email, :layout => false, :locals => { :pdf_url => pdf_url }
if settings.environment != :test && settings.respond_to?(:smtp)
- mail.delivery_method :smtp, settings.smtp
+ # Since the sinatra/indifferent_hash implementation that holds
+ # the settings converts all keys to strings, and the mail gem
+ # expects the keys as symbols, we need to create a new hash
+ # with the correct keys.
+ smtp_settings = Hash[settings.smtp.map { |e| [e[0].to_sym, e[1]] }]
+
+ logger.debug "smtp settings: #{smtp_settings.inspect}"
+ mail.delivery_method :smtp, smtp_settings
end
mail.deliver!
rescue Net::SMTPError => e