Receiving email in rails app with gem griddler

1.2k Views Asked by At

how to receiving email in rails app with gem griddler?

i follow this link : http://sendgrid.com/blog/receiving-email-in-your-rails-app-with-griddler/

my index.html.erb posts_controller :

Posts

<% if @posts.count > 0 %>
<% @posts.each do |post| %>
<blockquote>
<p><%= post.body %></p>
<small><%= post.email %></small>
</blockquote>
<% end %>
<% else %>
<p><em>Oops, doesn't look like there are any posts yet.</em></p>
<% end %>

my config/initializer/griddler.rb :

Griddler.configure do |config|
  config.processor_class = EmailProcessor # MyEmailProcessor
  config.to = :hash # :full, :email, :token
  config.from = :email # :full, :token, :hash
  # :raw    => 'AppName <[email protected]>'
  # :email  => '[email protected]'
  # :token  => 's13.6b2d13dc6a1d33db7644'
  # :hash   => { raw: [...], email: [...], token: [...], host: [...],
# name: [...] }
  config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
  config.email_service = :sendgrid # :cloudmailin, :postmark, :mandrill, :mailgun
end

my lib/email_processor.rb :

class EmailProcessor
  def self.process(email)
    # all of your application-specific code here - creating models,
    # processing reports, etc
    Post.create!({ body: email.body, email: email.from })
  end
end

but in index post view not get anything from callback, why?

1

There are 1 best solutions below

0
On

You have to provide redirect URL of your website at sendgrid http://sendgrid.com/developer/reply.

If you want to provide localhost URL then use https://ngrok.com/