I've set up rails application to receive mails and create bookmarks from. Herefore I included the gem 'mailgun'. Because its not working correctly however I want to use runscope to get a better insight on which data is sent.
I've done the following steps in my application: 1. Added mailgun to heroku 2. Set up an initializer
ActionMailer::Base.smtp_settings = {
port: 587,
address: 'smtp.mailgun.org',
user_name: ENV['MAILGUN_SMTP_LOGIN'],
password: ENV['MAILGUN_SMTP_PASSWORD'],
domain: 'appurlhere.com',
authentication: :plain,
content_type: 'text/html'
}
ActionMailer::Base.delivery_method = :smtp
# Makes debugging *way* easier.
ActionMailer::Base.raise_delivery_errors = true
Set up a route for incoming
post :incoming, to: 'incoming#create'
Created the incoming controller
def create @user = User.find_by_email(params[:sender]) @topic = @user.topics.find_by(title: params[:subject]) @url = "http://#{params["body-plain"]}" @user = User.create(email: params[:sender], password: "#{params[:subject]}") if @user.nil? @topic = Topic.create(title: params[:subject], user_id: @user.id) if @topic.nil? @bookmark = Bookmark.create(topic_id: @topic, user_id: @user, url: "what should be here") head 200 end
But now I don't get where I should adjust code so I can see better data (and debug) better. I tried adding code to my routes in mailgun but that didn't work.