Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From address SMTP setting isn't dynamically loaded #212

Open
michiels opened this issue Sep 29, 2016 · 0 comments
Open

From address SMTP setting isn't dynamically loaded #212

michiels opened this issue Sep 29, 2016 · 0 comments
Labels

Comments

@michiels
Copy link
Member

We have the SMTP settings functionality that allows a user to load SMTP settings from the database. This way people are able to dynamically configure the sending mail server for their Intercity instance.

In case of the "from email" setting, this is currently nog working properly. The setting is loaded at the class level in ApplicationMailer, which only gets loaded when the app or sidekiq worker starts up. This is a problem for first-use users, that have a blank from email setting when the Sidekiq service it started on the first run. Because of the class-level code, the email from setting is never updated, unless you restart the running Sidekiq service or full Intercity container.

This is the conflicting code:

class ApplicationMailer < ActionMailer::Base
  default from: Setting.get(:from_email)

This code is not executed on a per-email basis, but only on app boot. So we should either see if we can execute it in a proc:

class ApplicationMailer < ActionMailer::Base
  default from: -> { Setting.get(:from_email) }

Or find some other way of setting the "from" per-email, instead of as the ApplicationMailers default

@jvanbaarsen jvanbaarsen added the bug label Oct 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants