This is an adapter that allows Griddler to be used with Mandrill's Inbound Email Processing.
Add this line to your application's Gemfile:
gem 'griddler'
gem 'griddler-mandrill'
Please note that ONLY email received with SPF headers that are 'pass' or 'neutral' will be processed. Emails without SPF or with failing SPF will be silently swallowed and will not be set to your email processor.
thoughtbot has a blog post on how to use Griddler over on their blog: Giant Robots.
When adding a webhook in their administration panel, Mandrill will issue a HEAD request to check if the webhook is valid (see Adding Routes). If the HEAD request fails, Mandrill will not allow you to add the webhook. Since Griddler is only configured to handle POST requests, you will not be able to add the webhook as-is. To solve this, add a temporary route to your application that can handle the HEAD request:
# config/routes.rb
get "/email_processor", to: proc { [200, {}, ["OK"]] }, as: "mandrill_head_test_request"
Once you have correctly configured Mandrill, you can go ahead and delete this code.
Sometimes, due to circumstances outside our control, a domain may not have SPF set up or configured incorrectly.
If that is causing you to miss emails; you may configure the adapter to allow those results through to your applications email processor.
Please see RFC4408 Section 2.5 to determine whether your particular use case conforms to the SPF standard.
# Allow messages from domains without SPF configured
Griddler::Mandrill.spf_allow.add(:none)
# Allow messages from domains where SPF is erroring temporarily
Griddler::Mandrill.spf_allow.add(:temperror)
# Allow messages from domains where SPF is erroring permanently
Griddler::Mandrill.spf_allow.add(:permerror)
# Allow messages from domains where SPF is soft-failing
Griddler::Mandrill.spf_allow.add(:softfail)
# Allow messages from domains where SPF is failing
Griddler::Mandrill.spf_allow.add(:fail)
Griddler::Mandrill was extracted from Griddler by Stafford Brunk.
Griddler was written by Caleb Thompson and Joel Oliveira.