5

hope you guys can help me :)

I have an heroku app and have Mailgun integrated. I have already set up Mailgun, and my heroku repo is updated.

When I receive an mail through Mailgun, it should take all email sent and post it straight to my app, where it will hit the /incoming url and land on any action associated with it.

Problem is, that whenever I send an email to my mailgun smtp login; the mail is sent but this error appears on my logs:

Will retry in 600 seconds: klaha.77@gmail.com → http://jm-blocmarks.herokuapp.com/incoming 'test 3' Moved Permanently Server response: 301 Moved Permanently

These are my mailgun settings:

Mailgun Routes

Filter: catch_all()
forward("http://jm-blocmarks.herokuapp.com/incoming")

config/routes.rb

post :incoming, to: 'incoming#create'

controllers/incoming_controller.rb

class IncomingController < ApplicationController

  # http://stackoverflow.com/questions/1177863/how-do-i-ignore-the-authenticity-token-for-specific-actions-in-rails
  skip_before_action :verify_authenticity_token, only: [:create]

  def create
    # Take a look at these in your server logs
    # to get a sense of what you're dealing with.
    puts "INCOMING PARAMS HERE: #{params}"

    # You put the message-splitting and business
    # magic here. 

    # Assuming all went well. 
    head 200
  end
end

What am I doing wrong?

Thanks a lot!

Klaha
  • 37
  • 8
  • I think its useful to identify where the problem is. Have you tried using [Postman](https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en) and hitting the above url via POST request? What's the response from there? – Mutahhir Apr 27 '15 at 05:31
  • I have the same issue with a totally code. Postman gives me a "200 OK", even if there is bad (it's written that way), but Mailgun always reports 301 Moved Permanently. And to the same address!! – Nostalg.io Mar 20 '18 at 18:17

0 Answers0