-
Notifications
You must be signed in to change notification settings - Fork 185
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
Including 'mailgun-ruby' causes action_mailer configs in an initializer to not be used #86
Comments
Hey there! It looks like this is happening because requiring |
I'm not sure that's really what you want to do. I think requiring Railgun when Rails is defined makes sense. I'm more interested in why adding a delivery method prevents subsequent configuration from being used. |
@eebs I am not entirely sure why the railtie is causing this issue. I will try to dig deeper in to it today. |
Thanks. I'll also try and narrow things down from my end. I don't think I'm doing anything non-standard, but I'll try and create a simpler test case. |
I ran into this issue as well. I worked around it by moving the config to |
I've attempted the above with Devise and haven't been able to get the above working. Any advice on routing Devise mail through Mailgun? |
Version 1.2.4 with the fix is released. Closing. |
Hello, I have encountered an odd scenario where I am unable to set action_mailer configuration options if I include the
mailgun-ruby
gem.I have a Rails 4.2.7.1 app, where I configure ActionMailer in an initializer. Some of the options I set are the
default_url_options
andasset_host
, so that images in our emails have an absolute URL rather than a relative one. Without requiringmailgun-ruby
, emails are generated correctly. As soon as I addgem 'mailgun-ruby'
to my Gemfile, these options are no longer present at the time the email is rendered. This causes an exception to be throw by Rails stating that thedefault_url_options
are not set.I did some digging, and found that the root cause is the
Railgun::Railtie
, which adds themailgun
delivery method inbefore_initialize
hook. I can not find any explanation either in Rails or elsewhere that would explain why adding a delivery method would cause subsequent configuration to not be used. I looked at the Rails initialization events and found nothing that points to a reason why.I am able to work around this issue by requiring all necessary files except the Railtie. I'm not actually using the
mailgun
delivery method, my use case requires me to manually callRailgun.transform_for_mailgun(mail)
andclient.send_message('my-domain', message_payload)
, so adding the following to my Gemfile works:Do you have any thoughts on why this might be happening?
For development, my initializer is effectively this:
The text was updated successfully, but these errors were encountered: