mail messages being retrieved from davmail are incomplete
redmine 2.5.0 -> davmail 4.4.1-2225 -> exchange 2010
We process mail messages via rake like so:
rake -f /usr/local/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=xxx port=xxx username=xxx password=xxx project=pickle unknown_user=accept allow_override=project no_permission_check=1
Example of a test e-mail msg:
Subject: test email bug 1
Test message 1 body
After the rake is run, issues are created, however none of the fields are populated.
Looking at mail_handler.rb, we should have the complete email object @ line 74:
@email = email
Dumping @email.inspect to logger, I see the following quite incomplete msg:
#<Mail::Message:70045583405560, Multipart: false, Headers: <Date: Tue, 20 May 2014 16:36:48 -0400>, <Message-ID: <537bbce0d8a9b_2d6b43fb4c02b7e8889470@xxx>>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
Thinking that maybe this is connected to our local mail encoding, I tried sending plain text mail from gmail, but saw the same results.
My next thought was that something is off on the davmail -> exchange side, but retrieving the mail body via imap seems to work fine. (imap retrieval log attached).
Is it possible that there's a Redmine bug causing incomplete email msg retrieval?
#2 Updated by George Sakhnovsky over 8 years ago
I had a chance to dig a little deeper.
It seems that Net::IMAP's fetch() breaks when retrieving a uid with attr RFC822 from davmail. Changing line 33 of lib/redmine/imap.rb from
msg = imap.uid_fetch(uid,'RFC822').attr['RFC822']
msg = imap.uid_fetch(uid,'BODY').attr['BODY']
resolves the issue for me.