2013-11-13 3 views
2

Как получить электронную почту в приложении rails с помощью gem griddler?Получение электронной почты в приложении rails с gem griddler

я по этой ссылке: http://sendgrid.com/blog/receiving-email-in-your-rails-app-with-griddler/

мой index.html.erb posts_controller:

Сообщений

<% 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 %> 

мой конфиг/инициализатор/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 

но в представлении индексного сообщения не получить ничего от обратного вызова, почему?

ответ

Смежные вопросы