Project

General

Profile

Actions

Defect #14491

closed

MailHandler: Unable to determine target project (when allow_override=project and project=unassigned is used)

Added by Deoren Moor over 11 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Email receiving
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

We've had a problem with emails being rejected inexplicably for a long while now, but only recently did I realize that I could specify RAILS_ENV="development" to enable more detailed logging. That done, this is what the development.log file had to say:

Receiving message 14135
  ^[[1m^[[35mUser Load (0.7ms)^[[0m  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND (LOWER(mail) = 'jdoe@example.com') LIMIT 1
  ^[[1m^[[36mProject Load (0.2ms)^[[0m  ^[[1mSELECT `projects`.* FROM `projects` WHERE `projects`.`identifier` IS NULL LIMIT 1^[[0m
MailHandler: missing information from John Doe: Unable to determine target project

Here is the scraping script that we use:

#!/bin/bash

# Purpose:   Fetch emails and import into Redmine
# Reference: http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails

cd /opt/redmine

sudo -u www-data bundle exec rake -f /opt/redmine/Rakefile redmine:email:receive_imap \
    RAILS_ENV="development" \
    host=mail.example.com username=support@example.com password=PASSWORD \
    move_on_success=accepted_emails move_on_failure=rejected_emails \
    project=unassigned category=unassigned tracker=support \
    no_permission_check=1 unknown_user=accept port=993 ssl=1 \
    allow_override=project,tracker,status,priority,category,assigned_to,\
    fixed_version,start_date,due_date,estimated_hours,\
    done_ratio > /dev/null 2>&1

What is odd is that I can mark the email as unread, place it back in the Inbox and let the script try again and 9/10 times it will successfully pick it on the 2nd try. I haven't been running the scraping process in development mode long enough to see what the other failures log.


Files

debug_options.patch (702 Bytes) debug_options.patch Jean-Philippe Lang, 2013-08-07 21:56

Related issues

Related to Redmine - Patch #12937: mail_handler patchClosed

Actions
Actions #1

Updated by Francisco Ramirez over 11 years ago

I found a problem when i was integrating VTiger and Redmine using email task in a workflow, the problem was that for some reason VTiger email make the value of project to get down one line when you leave spaces between the ":", oddly enought when I resent the same email in thunderbird it works well, I check the "original format ctrl-U" in thunderbird and I see the problem I'm describing, for example

project : my_dear_proyect

becames

project :
my_dear_proyect

And that was the problem, remove all spaces and perhaps you would solve your issue like I did :)

To the great Redmine Team, perhaps you should update your documentations with this little issue as a Note

Actions #2

Updated by Deoren Moor over 11 years ago

Francisco Ramirez wrote:

And that was the problem, remove all spaces and perhaps you would solve your issue like I did :)

Our users don't include those attributes, instead we rely on the provided script to force all incoming emails that are not already tagged (we do not have problems with those) into an "unassigned" project for manual processing.

Thanks for the tip though.

Actions #3

Updated by Jean-Philippe Lang over 11 years ago

Deoren, that would be great if you could attach a raw email for which you've got the failure.

Actions #4

Updated by Jean-Philippe Lang over 11 years ago

This queries shows that the project keyword is not properly parsed:

SELECT `projects`.* FROM `projects` WHERE `projects`.`identifier` IS NULL LIMIT 1

I've committed a fix in r12067 so that the default is used if an invalid/malformed project keyword is present in the email. But still, I'd really like to get your failling email to see what is going wrong.

Actions #5

Updated by Deoren Moor over 11 years ago

Jean-Philippe Lang wrote:

This queries shows that the project keyword is not properly parsed:

Hi,

Sorry for the late reply. The emails that we have a problem with don't use keywords, they're sent by our users directly to a support address. Our goal with the provided scraping script was to force those emails into an unassigned project where we would review them and assign as needed.

Jean-Philippe Lang wrote:

Deoren, that would be great if you could attach a raw email for which you've got the failure.

I don't have one at the moment and it's hard to reproduce. Once I get one (it could be a while), should I email you a copy of it? I'm hesitant to post the entire raw email here due to spam/etc.

Actions #6

Updated by Jean-Philippe Lang over 11 years ago

You can send it to me by email.

Actions #7

Updated by Deoren Moor over 11 years ago

Jean-Philippe Lang wrote:

You can send it to me by email.

Thanks. I'm sending the email now. Both of the emails were successfully scraped once I marked them as unread and put them back into the Inbox for a second scrape attempt. I did not include the log entries from the successful processing, but let me know and I'll send those your way also.

Actions #8

Updated by Jean-Philippe Lang over 11 years ago

  • Assignee set to Jean-Philippe Lang

Thanks, I've made a few attemps with the first email and they all suceeded. I really can't see why it fails sometimes. I'll merge some changes for 2.3.3 to get more debug information on this issue.

Actions #9

Updated by Deoren Moor over 11 years ago

Jean-Philippe Lang wrote:

I really can't see why it fails sometimes.

Thanks for looking into this. Is there any additional information I can provide about the OS or environment, or is it looking more like a Redmine specific issue? Please let me know if I can help in any other way.

Actions #10

Updated by Jean-Philippe Lang over 11 years ago

It looks like your project=unassigned option is lost. Can you try with the following patch applied. There's a slight change and some debug messages, thanks.

Actions #11

Updated by Deoren Moor over 11 years ago

Jean-Philippe Lang wrote:

It looks like your project=unassigned option is lost. Can you try with the following patch applied. There's a slight change and some debug messages, thanks.

Patch applied and Apache restarted (what this box uses). I'll let you know as soon as I spot the problem again.

Actions #12

Updated by Deoren Moor almost 11 years ago

Jean-Philippe,

Since I've applied that patch you provided I've not seen any further emails rejected. I just wanted to post back and mention that. Thanks.

Actions #13

Updated by Miquel Coll over 10 years ago

Deoren Moor wrote:

Jean-Philippe,

Since I've applied that patch you provided I've not seen any further emails rejected. I just wanted to post back and mention that. Thanks.

I have the same problem with lost project (using redmine 2.4.5). It's been working fine until a few days ago, and now no new issues are created. I've applied the patch that Jean-Phillipe suggested and now it works. Odd. My script to get emails by pop3 is this:

/usr/local/bin/rake /app/redmine-2.4.5/Rakefile redmine:email:receive_pop3 RAILS_ENV="production" host=myhost.com port=110 ssl=0 username=redmine password=secret project=hdk unknown_user=accept folder=inbox move_on_success=redmine-processats move_on_failure=redmine-error allow_override=project,tracker,status,priority,category,assigned_to,fixed_version,start_date,due_date,estimated_hours,done_ratio unknown_user=accept no_permission_check=1 --trace >> /app/redmine-2.4.5/log/cron_imap_`date +\%Y\%m\%d`.log &2>&1

Actions #14

Updated by Toshi MARUYAMA about 10 years ago

  • Target version set to 2.6.0
Actions #15

Updated by Jean-Philippe Lang about 10 years ago

  • Status changed from New to Closed
Actions #16

Updated by Toshi MARUYAMA about 10 years ago

  • Status changed from Closed to Reopened
Actions #17

Updated by Toshi MARUYAMA about 10 years ago

note-10 patch is not applied yet.

Actions #18

Updated by Toshi MARUYAMA about 10 years ago

  • Status changed from Reopened to Closed
  • Resolution set to Fixed

Toshi MARUYAMA wrote:

note-10 patch is not applied yet.

It is committed in trunk r13457 and 2.6-stable r13459.

Actions #19

Updated by Go MAEDA almost 6 years ago

Actions

Also available in: Atom PDF