首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用gem griddler在rails应用程序中接收电子邮件

使用gem griddler在rails应用程序中接收电子邮件
EN

Stack Overflow用户
提问于 2013-11-13 17:36:16
回答 1查看 1.2K关注 0票数 2

如何使用gem griddler在rails应用程序中接收电子邮件?

我关注这个链接:http://sendgrid.com/blog/receiving-email-in-your-rails-app-with-griddler/

my index.html.erb posts_controller:

帖子

代码语言:javascript
复制
<% 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 %>

我的config/initializer/griddler.rb:

代码语言:javascript
复制
Griddler.configure do |config|
  config.processor_class = EmailProcessor # MyEmailProcessor
  config.to = :hash # :full, :email, :token
  config.from = :email # :full, :token, :hash
  # :raw    => 'AppName <s13.6b2d13dc6a1d33db7644@mail.myapp.com>'
  # :email  => 's13.6b2d13dc6a1d33db7644@mail.myapp.com'
  # :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

我的lib/email_processor.rb:

代码语言:javascript
复制
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

但是在索引post视图中没有从回调中获得任何东西,为什么?

EN

回答 1

Stack Overflow用户

发布于 2013-12-09 20:05:06

您必须提供您的网站在sendgrid http://sendgrid.com/developer/reply的重定向网址。

如果要提供本地主机URL,请使用https://ngrok.com/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19950187

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档