Defect #16933

mail messages being retrieved from davmail are incomplete

Added by George Sakhnovsky over 8 years ago. Updated over 8 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-
Resolution: Affected version:2.5.0

Description

Our setup:

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

Project: project1
Tracker: Bug
Priority: Urgent

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:

def receive(email)
@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?

redmine_imap.txt Magnifier - imap msg retrieval (3.15 KB) George Sakhnovsky, 2014-05-20 23:35

History

#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')[0].attr['RFC822']

to

msg = imap.uid_fetch(uid,'BODY[]')[0].attr['BODY[]']

resolves the issue for me.

#3 Updated by Toshi MARUYAMA over 8 years ago

  • Subject changed from mail messages being retrieved by redmine are incomplete to mail messages being retrieved from davmail are incomplete

Also available in: Atom PDF