Open btkramm opened 7 years ago
can you paste your request url, that might be the reason I guess, you migt have missed messages
https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages
@rkapil12 Doesn't mailgun_rails already do that? In lib/mailgun_rails/client.rb the send_message function uses the mailgun_url which is an api_url of "https://api:#{api_key}@api.mailgun.net/v3/#{domain}" + "/messages"
Edit: In testing with postman against mailgun's api, I can get it to return 'Mailgun Magnificent API' if I leave off the /messages from the url. My understanding though is that mailgun_rails is adding /message to whatever url is entered as the domain in the config file.
So I am not sure if this fixes your issue @btkramm , but I had the same error when I was using an incorrect domain. The documentation is a little ambiguous:
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: '<mailgun api key>',
domain: '<mailgun domain>'
}
The "mailgun_domain" is the domain name that you register with mailgun. Let's say you registered mailgunrailsrocks.com
and link it to your mailgun account. You will see something like this in your mailgun dashboard;
State Active
IP Address 127.0.0.1
SMTP Hostname smtp.mailgun.org
Default SMTP Loginpostmaster@mailgunrailsrocks.com
API Base URL https://api.mailgun.net/v3/mailgunrailsrocks.com
API Key key-abcxyz
you should NOT use https://api.mailgun.net/v3/mailgunrailsrocks.com/messages
instead use the literal domain of mailgunrailsrocks.com
in your config
so it will look like this:
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: 'key-abcxyz',
domain: 'mailgunrailsrocks.com'
}
Had the same issue on production. Restarting my server solved it. My guess is caching issues, and instead of pinpointing what was stale (DNS, ENVs etc...), i just restarted the whole thing.
Ever found a solution?
Had the same issue. It turns out I forget to source the file where the api key and domain are exported.
Hi! I can send emails in my development environment but I can't in production. I'm getting the error: "765: unexpected token at 'Mailgun Magnificent API'"