Project

General

Profile

Issue fetching html email

Added by Chris Derham almost 9 years ago

I have a new install on my mac using bitnami. Everything seems to be working great except fetching emails. The command I am using is

rake /Applications/redmine-3.0.1-0/apps/redmine/htdocs/Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=***** password=***** ssl=1 project=test tracker=bug unknown_user=accept --trace

This connects to the server, and flags the emails as read, but no issues are actually created. I found some links suggesting to update production.rb such that I change the following two lines, then stop/start
  1. config.action_mailer.logger = nil
config.action_mailer.raise_delivery_errors = true

Now in production.log I see the following line

An unexpected error occurred when receiving email: uninitialized constant MailHandler::HTML

Google found a post where someone else had hit this same problem, but I don't know how to proceed. Any tips appreciated.

chris-macbookpro:htdocs chrisderham$ RAILS_ENV=PRODUCTION script/about
script/about no longer exists, please use bin/about instead.
chris-macbookpro:htdocs chrisderham$ RAILS_ENV=PRODUCTION bin/about
/Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /opt in PATH, mode 040777
/Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': dlopen(/Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
Reason: image not found - /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/config/application.rb:5:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/redmine-3.0.1-0/apps/redmine/htdocs/config/environment.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from bin/about:4:in `<main>'
chris-macbookpro:htdocs chrisderham$


Replies (4)

RE: Issue fetching html email - Added by nejc nejc almost 9 years ago

Same problem here!

Did you find the solution?

When I send mail from the gmail everything works ok. It also works when I send it from outlook as "Plain text". But it does not work if I send it "as HTML" which is the default mode in the outlook.

An error reported is: An unexpected error occurred when receiving email: uninitialized constant MailHandler::HTML. Error probably happens in function plain_text_body().

Thanks for any tips!

RE: Issue fetching html email - Added by Chris Derham almost 9 years ago

As a work around, we are going to have a separate process poll the inbox. It will pull down any emails, strip html, save attachments to a folder, and then using the Redmine API (http://www.redmine.org/projects/redmine/wiki/Rest_api_with_php) submit a new entry. There are code examples in multiple languages, but Java is a good fit for out coding skills. There is even a Java client side library https://github.com/taskadapter/redmine-java-api.

I would have thought that receiving html emails would be high on the priority list for Redmine, and/or would stripping html from them. Maybe I miss-understand something fundamental.

We haven't coded this yet, but in principal this work around will be simple enough to code, so not a show stopper for us.

Hope this helps someone.

Chris

RE: Issue fetching html email - Added by nejc nejc almost 9 years ago

That is realy a huge workaround. Does not seem easier to find error in ruby html parser or just replace it with some other?

RE: Issue fetching html email - Added by Chris Derham almost 9 years ago

My take on the problem is that email typically contains two bodies - a plain text one and an html one. In this case the plain text body is missing. When the ruby code can't find the plain text, it gives up. The suggested workaround is a valid method to resolve the problems we are having. I just have some java lib read the email, another java lib strip the html, and then call the redmine api to submit the request. I am not sure what you mean by "huge workaround" - few hours coding reusing existing libraries and it just works.

I have zero ruby skiils. If you have, then it may well be easier for you to do as you suggest. The code is open source. Please submit your fix and they will incorporate into the system, for the benefit of us all.

    (1-4/4)