thoughtbot / griddler-sendgrid Goto Github PK
View Code? Open in Web Editor NEWSendGrid adapter for Griddler
License: MIT License
SendGrid adapter for Griddler
License: MIT License
The link here has to be updated: SendGrid has done a great tutorial on integrating Griddler with your application.
The new URL is https://sendgrid.com/blog/receiving-email-in-your-rails-app-with-griddler/
My company, Groundswell, ran a bunch of our email tests against the current version of master. We got an error from the JSON parsing of a few emails.
Parsing an empty JSON string JSON.parse(""
) throws a JSON::ParserError: A JSON text must at least contain two octets!
Guarding against empty strings, in addition to nils, on this line: https://github.com/thoughtbot/griddler-sendgrid/blob/master/lib/griddler/sendgrid/adapter.rb#L51 is really important!
A PR fix is at: #12
running rails 3.2.14
using griddler (1.0.0) and griddler-sendgrid (0.0.1)
using both the 'test integration' button in the 'Event Notification' app of SendGrid and using the example curl post request:
curl -X POST -H "Content-Type: application/json" -d '[{"email":"[email protected]","timestamp":1337197600,"smtp-id":"[email protected]","event":"processed"},{"email":"[email protected]","timestamp":1337966815,"category":"newuser","event":"click","url":"http://sendgrid.com"},{"email":"[email protected]","timestamp":1337969592,"smtp-id":"[email protected]","event":"processed"}]'
getting this error:
undefined method `split' for nil:NilClass
with this backtrace:
- griddler (1.0.0) lib/griddler/email_parser.rb:59:in `extract_email_address'
- griddler (1.0.0) lib/griddler/email_parser.rb:15:in `parse_address'
- griddler (1.0.0) lib/griddler/email.rb:43:in `extract_address'
- griddler (1.0.0) lib/griddler/email.rb:13:in `initialize'
- griddler (1.0.0) app/controllers/griddler/emails_controller.rb:4:in `block in create'
- griddler (1.0.0) app/controllers/griddler/emails_controller.rb:3:in `create'
Hello,
I have followed a tutorial and configured everything as it said and I have issues receiving an api call.
How can I check whether my reply comment hit the API url?
This adapter has languished and deserves a new maintainer.
If you're interested, comment here with your qualifications to be the new maintainer.
I am running Ruby 2.2.3 and unable to get sendgrid incoming parse to return raw_html information. The only response content I get is "body", but it is stripped of any formatting or HTML.
I believe the API for sendgrid might have changed since this gem was created. If this is correct, then it may need to be updated.
I didnt have this same problem with other services (Mandrill, Mailgun).
Hi,
I am using gem 'griddler' with gem 'griddler-sendgrid' in my ruby on rails app for incoming mails.
It is working fine on staging server but getting issue with production server.
There is no issue in my configuration. I have confirmed this with sendgrid support. They told me to use only DKIM validation and remove SPF check from validations.
I have checked both gem for that but didn't find anything relevant to that.
Here is my gem configuration details:
ruby '2.2.3'
gem 'rails', '4.1.2'
gem 'griddler', '1.4.0'
gem 'griddler-sendgrid', '1.0.0'
Can someone suggest me how can I skip SPF check validation in gem 'griddler-sendgrid'?
Thanks in advance!
We are using the master branch of griddler-sendgrid now because our code needs working bcc. Could you create a new version please?
Hey,
I added this to my Gemfile
gem 'griddler-sendgrid'
and I get this error
Fetching source index from http://rubygems.org/
Resolving dependencies...
Could not find gem 'griddler-sendgrid (>= 0) ruby' in the gems available on this machine.
When I tried with this in my Gemfile
gem 'griddler-sendgrid', :git => 'https://github.com/thoughtbot/griddler-sendgrid.git'
bundle install
was successful but when I tried to run server rails s
I got this error
/Users/manoj/.rvm/gems/[email protected]/bundler/gems/griddler-sendgrid-2ccf8b7068bc/lib/griddler/sendgrid.rb:10:in `<top (required)>': undefined method `adapter_registry' for Griddler:Module (NoMethodError)
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `require'
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `rescue in block in require'
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:66:in `block in require'
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/manoj/.rvm/gems/ruby-1.9.3-p484@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/manoj/projects/interakt/config/application.rb:7:in `<top (required)>'
from /Users/manoj/.rvm/gems/[email protected]/gems/railties-3.2.18/lib/rails/commands.rb:53:in `require'
from /Users/manoj/.rvm/gems/[email protected]/gems/railties-3.2.18/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/manoj/.rvm/gems/[email protected]/gems/railties-3.2.18/lib/rails/commands.rb:50:in `tap'
from /Users/manoj/.rvm/gems/[email protected]/gems/railties-3.2.18/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Is there some steps to follow to start with it, that are not there in readme
?
Hi,
I'm using griddler to accept incoming email. For some emails which has some non-English characters (like Bosnian language etc.) I'm getting following error. It looks like in most of the cases such emails are coming from Outlook clients (office365). Seems to be working fine with gmail.
I was trying to use rack-utf8_sanitizer gem like this:
config.middleware.insert 0, Rack::UTF8Sanitizer, sanitizable_content_types: ['multipart/form-data', 'multipart/alternative', 'multipart/mixed'], only: ['rack.input']
It works, but if there is an attachment in the email, this breaks it.
If I set Send Raw
in the SendGrid configuration, the request is coming in fine, but then I don't have a body (as noted in this gem readme)
Any help would be greatly appreciated!
Rack::QueryParser::InvalidParameterError: Invalid encoding for parameter: <html>
...
<div>� Moshe</div>
...
</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr...
from action_dispatch/request/utils.rb:39:in `check_param_encoding'
from action_dispatch/request/utils.rb:34:in `block in check_param_encoding'
from action_dispatch/request/utils.rb:34:in `each_value'
from action_dispatch/request/utils.rb:34:in `check_param_encoding'
from action_dispatch/http/request.rb:403:in `block in POST'
from rack/request.rb:69:in `fetch'
from rack/request.rb:69:in `fetch_header'
from action_dispatch/http/request.rb:398:in `POST'
from action_dispatch/http/parameters.rb:55:in `parameters'
from action_dispatch/http/filter_parameters.rb:43:in `filtered_parameters'
from action_controller/metal/instrumentation.rb:24:in `process_action'
from action_controller/metal/params_wrapper.rb:249:in `process_action'
from active_record/railties/controller_runtime.rb:27:in `process_action'
from scout_apm/instruments/action_controller_rails_3_rails4.rb:120:in `process_action'
from abstract_controller/base.rb:165:in `process'
from action_view/rendering.rb:39:in `process'
from action_controller/metal.rb:190:in `dispatch'
from action_controller/metal.rb:254:in `dispatch'
from action_dispatch/routing/route_set.rb:50:in `dispatch'
from action_dispatch/routing/route_set.rb:33:in `serve'
from action_dispatch/journey/router.rb:50:in `block in serve'
from action_dispatch/journey/router.rb:32:in `each'
from action_dispatch/journey/router.rb:32:in `serve'
from action_dispatch/routing/route_set.rb:842:in `call'
from scout_apm/instruments/rails_router.rb:29:in `call_with_scout_instruments'
from scout_apm/middleware.rb:17:in `call'
from rack/attack.rb:103:in `call'
from rack/attack.rb:127:in `call'
from active_record/middleware/database_selector.rb:53:in `block in call'
from active_record/middleware/database_selector/resolver.rb:71:in `block (2 levels) in write_to_primary'
from active_support/notifications/instrumenter.rb:24:in `instrument'
from active_record/middleware/database_selector/resolver.rb:70:in `block in write_to_primary'
from active_record/connection_handling.rb:388:in `with_role_and_shard'
from active_record/connection_handling.rb:175:in `connected_to'
from active_record/middleware/database_selector/resolver.rb:69:in `write_to_primary'
from active_record/middleware/database_selector/resolver.rb:44:in `write'
from active_record/middleware/database_selector.rb:65:in `select_database'
from active_record/middleware/database_selector.rb:52:in `call'
from warden/manager.rb:36:in `block in call'
from warden/manager.rb:34:in `catch'
from warden/manager.rb:34:in `call'
from rack/tempfile_reaper.rb:15:in `call'
from rack/etag.rb:27:in `call'
from rack/conditional_get.rb:40:in `call'
from rack/head.rb:12:in `call'
from action_dispatch/http/permissions_policy.rb:22:in `call'
from action_dispatch/http/content_security_policy.rb:19:in `call'
from rack/session/abstract/id.rb:266:in `context'
from rack/session/abstract/id.rb:260:in `call'
from action_dispatch/middleware/cookies.rb:689:in `call'
from action_dispatch/middleware/callbacks.rb:27:in `block in call'
from active_support/callbacks.rb:98:in `run_callbacks'
from action_dispatch/middleware/callbacks.rb:26:in `call'
from action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
from action_dispatch/middleware/debug_exceptions.rb:29:in `call'
from action_dispatch/middleware/show_exceptions.rb:33:in `call'
from rails/rack/logger.rb:37:in `call_app'
from rails/rack/logger.rb:26:in `block in call'
from active_support/tagged_logging.rb:99:in `block in tagged'
from active_support/tagged_logging.rb:37:in `tagged'
from active_support/tagged_logging.rb:99:in `tagged'
from rails/rack/logger.rb:26:in `call'
from action_dispatch/middleware/remote_ip.rb:81:in `call'
from request_store/middleware.rb:19:in `call'
from action_dispatch/middleware/request_id.rb:26:in `call'
from rack/method_override.rb:24:in `call'
from rack/runtime.rb:22:in `call'
from rails_autoscale_agent/middleware.rb:27:in `call'
from active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from action_dispatch/middleware/executor.rb:14:in `call'
from action_dispatch/middleware/static.rb:24:in `call'
from font_assets/middleware.rb:17:in `block in call'
from font_assets/middleware.rb:40:in `do_request'
from font_assets/middleware.rb:16:in `call'
from rack/sendfile.rb:110:in `call'
from action_dispatch/middleware/ssl.rb:77:in `call'
from action_dispatch/middleware/host_authorization.rb:142:in `call'
from rack/cors.rb:100:in `call'
from rack/utf8_sanitizer.rb:22:in `call'
from raven/integrations/rack.rb:51:in `call'
from scout_apm/instruments/middleware_summary.rb:58:in `call'
from rails/engine.rb:539:in `call'
from puma/configuration.rb:252:in `call'
from puma/request.rb:77:in `block in handle_request'
from puma/thread_pool.rb:340:in `with_force_shutdown'
from puma/request.rb:76:in `handle_request'
from puma/server.rb:441:in `process_client'
from puma/thread_pool.rb:147:in `block in spawn_thread'
from logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
When the to
address from the SendGrid parse webhook contains UTF-8 characters in the display name (e.g. "Mé <[email protected]>"
) an error is raised in the controller action before instantiating a new processor.
Mail::Field::ParseError: Mail::AddressList can not parse |Mé <[email protected]>|
Reason was: Only able to parse up to Mé
gems/mail-2.6.5/lib/mail/parsers/address_lists_parser.rb: 15:in `parse'
gems/mail-2.6.5/lib/mail/elements/address_list.rb: 23:in `initialize'
gems/griddler-sendgrid-1.0.0/lib/griddler/sendgrid/adapter.rb: 27:in `new'
gems/griddler-sendgrid-1.0.0/lib/griddler/sendgrid/adapter.rb: 27:in `recipients'
gems/griddler-sendgrid-1.0.0/lib/griddler/sendgrid/adapter.rb: 15:in `normalize_params'
gems/griddler-sendgrid-1.0.0/lib/griddler/sendgrid/adapter.rb: 10:in `normalize_params'
gems/griddler-1.4.0/app/controllers/griddler/emails_controller.rb: 17:in `normalized_params'
gems/griddler-1.4.0/app/controllers/griddler/emails_controller.rb: 3:in `create'
Since my processor is never instantiated, I am unable to catch this error or hook-in and scrub the display name in my app. Many major email clients (e.g. GMail) handle this case.
I did a bit of digging into the Mail gem and think this mikel/mail#685 may be relevant.
Here is my app's setup:
griddler (1.4.0)
htmlentities
rails (>= 3.2.0)
griddler-sendgrid (1.0.0)
griddler
mail (2.6.5)
mime-types (>= 1.16, < 4)
Griddler.configure do |config|
config.processor_class = ListingEmailProcessor
config.processor_method = :process
config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
config.email_service = :sendgrid
end
I was having issues setting up griddler with SendGrid, the body text wasn't appearing. After a lot of headache, I figured out what was wrong. When setting up Inbound Parse settings in your dashboard in SendGrid, make sure to uncheck "Spam Check" and "Send Raw" settings for your parser. Spam check stripped out the body content because it thought some emails were spam (I'm sure there is more you could do to set spam filters correctly). Send Raw was, I am guessing, sending the email in a way that griddler couldn't find the body content and therefore generated nothing.
Once I removed both of these settings, everything worked as expected. Hope to save others similar headaches setting up there inbound email parsers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.