thoughtbot / griddler

Simplify receiving email in Rails (deprecated)
http://griddler.io/
MIT License
1.38k stars 199 forks source link

Parsing email doesn't work #216

Closed vinhnglx closed 9 years ago

vinhnglx commented 9 years ago

guys, I've just configured parsing email with sendgrid. But it doesn't work. Here is the code:

gem 'griddler'
gem 'griddler-sendgrid'
Griddler.configure do |config|
  config.processor_class = EmailProcessor # CommentViaEmail
  config.processor_method = :process # :create_comment (A method on CommentViaEmail)
  config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
  config.email_service = :sendgrid # :cloudmailin, :postmark, :mandrill, :mailgun
end
class EmailProcessor
  def initialize(email)
    @email = email
  end

  def process
    # all of your application-specific code here - creating models,
    # processing reports, etc

    # here's an example of model creation
    p '83093840593840958309'
    ap @email
    ap @email.subject
    # user = User.find_by_email(@email.from[:email])
    # user.posts.create!(
    #   subject: @email.subject,
    #   body: @email.body
    # )
  end
end
root 'welcome#index'
mount_griddler

sendgrid

screenshot_7_17_15__10_37_am

But when I send the email to `@rsrv.co`, I don't see any activity from log console**

1__tmux__tmux_

May I wrong configure in somewhere? Please help me. Thanks in advance.

gabebw commented 9 years ago

Your configuration looks correct at first glance.

I do see this in your log screenshot:

Cannot render console from [IP ADDRESS]! Allowed networks: 127.0.0.1

That's from web-console: https://github.com/rails/web-console#configweb_consolewhiny_requests

web-console triggers when there's an error, so I suspect there's an error happening somehow in your Rails application that's not getting caught.

Can you try running your app in a non-development environment and then putting it on ngrok and trying again, or (better) deploying it to a free Heroku instance while you debug?

There could be a few problems:

I suspect it's the third one, but I need more information.

vinhnglx commented 9 years ago

@gabebw

The web-console appear because the app and ngrok are configured in vagrant environment.

I also try create example app and ngrok without vagrant. It's still not working.

I'll try deploy to Heroku and get back to you.

Thanks

gabebw commented 9 years ago

Is the email definitely getting to Sendgrid? You can check your recent activity using this page: https://sendgrid.com/docs/User_Guide/email_activity.html

vinhnglx commented 9 years ago

@gabebw I saw my domain have a lot MX records from google. I afraid MX confict with Google's MX. So, I created a sub-domain and re-config MX record host to sub-domain, point to mx.sendgrid.net. But I still don't see any activity on my server.

Anyway, thanks for your suggestion. I'll check recent activity. (whew)

vinhnglx commented 9 years ago

@gabebw The domain have Google's MX conflict with Sendgrid's MX. I tried use bymail.in address (https://sendgrid.com/blog/parse-webhook-tutorial/) then the system works fine.

gabebw commented 9 years ago

Excellent! I'm glad it's working for you.