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

Unable to send messages (using Rails 4) #25

Closed
hugofloss opened this issue Nov 4, 2013 · 6 comments
Closed

Unable to send messages (using Rails 4) #25

hugofloss opened this issue Nov 4, 2013 · 6 comments

Comments

@hugofloss
Copy link

Great work on the Rails gem. After trying to integrate it with my Rails application I'm stumbling on a couple of problems. What I did to recreate my situation:

  1. Add config to a mailgun.rb initializer:
Mailgun.configure do |config|
  config.api_key = ENV['MAILGUN_API_KEY']
  config.domain  = ENV['MAILGUN_DOMAIN']
end
  1. Trying to send an email from a controller:
    Mailgun.messages.send_email(parameters)

Problems:
It doesn't recognize the messages method.

Things I have tried:
Put Mailgun in an instance variable:

@mailgun = Mailgun()

If I do the above, it asks me for the :domain which I need to set apart from the initializer (huh?). The second downside to this is that I can only make it work by connecting without an initializer directly from the application controller with a before_filter, but that is less from ideal because I don't want to connect again to the Mailgun API every single refresh.

I'm really stuck here, thanks.

@andresbravog
Copy link
Contributor

@jenskanis can you check that ENV['MAILGUN_DOMAIN'] is defined and correctly set in your environment ?

@hugofloss
Copy link
Author

@andresbravog yes I've put them in my .env file which are loaded by foreman.

@andresbravog
Copy link
Contributor

@jenskanis you are right i'm able to reproduce the error with rails 4.0.1 and ruby-2.0.0-p247. I'll try to fix it as soon as possible

@hugofloss
Copy link
Author

Thanks in advance:)

@andresbravog
Copy link
Contributor

already fixed here dbeb8b9

use master:

gem 'mailgun', git: 'git@github.com:HashNuke/mailgun.git'

@hugofloss
Copy link
Author

Thanks, I will test this ASAP and close it if it's resolved.

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