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

Breaks local email delivery #28

Closed
sfcgeorge opened this issue Dec 21, 2016 · 3 comments
Closed

Breaks local email delivery #28

sfcgeorge opened this issue Dec 21, 2016 · 3 comments

Comments

@sfcgeorge
Copy link
Contributor

This is a weird one (sorry). Adding the Maildown gem breaks local email delivery into tmp/mails. Removing the gem and they start saving again. It doesn't cause any issues in production, and the dev /rails/mailers preview works fine. So real email sending and rendering is fine, but local delivery breaks.

The only monkeypatch Maildown does to Rails is in lib/maildown/ext/action_mailer.rb and that's only 17 LOC. So I went through commenting and uncommenting bits of that file until I found the culprit is line 3

mail_view_klass = ActionMailer::Base.view_context_class

Which is weird as that barely does anything. The method view_context_class is included from several files deep with Rails and has some funky stuff in it like an anonymous class. But maybe the issue is nothing to do with that method; could it be a load order / autoloading thing?

I'm at a bit of a loss, any thoughts?

@schneems
Copy link
Member

No clue. How are you doing local mail delivery? I use mail_view to preview emails.

@sfcgeorge
Copy link
Contributor Author

Just config.action_mailer.delivery_method = :file I think.

@sfcgeorge
Copy link
Contributor Author

I found a way to make it work. Simply add config for file_settings. I don't know why it isn't needed without Maildown, then adding Maildown breaks file delivery until that config is added. I don't see any Maildown code that should interfere so it seems it might be a bug in Rails, easy to work around anyway so closing issue.

config/environments/development.rb

config.action_mailer.delivery_method = :file
# config.action_mailer.perform_deliveries = true # not needed it seems
config.action_mailer.file_settings = {
  location: Rails.root.join("tmp/mails")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants