422: Unprocessable Entity in mail_handler

Added by Ingmar Heinrich about 9 years ago

Hi there,

I'm trying to pipe emails into issues, using http://www.redmine.org/wiki/1/RedmineReceivingEmails, going the first option "Forwarding emails from your email server". The pipe from Postfix is working, but in the log I see

Parameters: {"action"=>"index", "allow_override"=>"priority", "controller"=>"mail_handler", "issue"=>{"project"=>"Support", "tracker"=>"Support"}, "key"=>"XXXXXXXXXXXXXXXX", "email"=>"From XXXXXXXXXXXXXXXX Wed Oct 15 17:27:48 2008\nReturn-Path: <XXXXXXXXXXXXXXXXXXX>\nX-Original-To: XXXXXXXXXXXXXXXXXXXXX\nDelivered-To: XXXXXXXXXXXXXXXXXXXX\nReceived: from XXXXXXXXXXXXXXXXX (XXXXXXXXXXXXXXXXXXXX [192.168.1.42])\n\tby XXXXXXXXXXXXXXXXXXX (Postfix) with ESMTP id XXXXXXXXX\n\tfor <XXXXXXXXXXXXXXXXXXXXXXXXx>; Wed, 15 Oct 2008 17:27:48 +0200 (CEST)\nReceived: from XXXXXXXXXXXXXXXXXXXX (XXXXXXXXXXXXXXXXXXXXXXX [192.168.2.220])\n\tby XXXXXXXXXXXXXXXXXXX (Postfix) with ESMTP id XXXXXXXXXXXXXX\n\tfor <XXXXXXXXXXXXXXXXXXX>; Wed, 15 Oct 2008 17:27:48 +0200 (CEST)\nReceived: by XXXXXXXXXXXXXXXXX (Postfix, from userid 10050)\n\tid XXXXXXXXXXX; Wed, 15 Oct 2008 17:27:48 +0200 (CEST)\nDate: Wed, 15 Oct 2008 17:27:48 +0200\nTo: XXXXXXXXXXXXXXXXXXXXXXXX\nSubject: sdvdsvvds\nUser-Agent: nail 11.25 7/29/05\nMIME-Version: 1.0\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\nMessage-Id: <XXXXXXXXXXXXXXXXXXXXXXX>\nFrom: XXXXXXXXXXXXXXXXXXXXXXX\n\nac\naa\nc\n"}
Completed in 0.22801 (4 reqs/sec) | Rendering: 0.00026 (0%) | DB: 0.00444 (1%) | 422 Unprocessable Entity [https://XXXXXXXXXXXXXXXXXX/mail_handler]

What might be the problem?

Thanks,
Ingmar

Replies (9)

RE: 422: Unprocessable Entity in mail_handler - Added by Thomas Lecavelier about 9 years ago

422 is an HTTP error added by WebDav. Check your svn/apache/webdav conf.

RE: 422: Unprocessable Entity in mail_handler - Added by Ingmar Heinrich about 9 years ago

Umm, there's no Webdav involved.

RE: 422: Unprocessable Entity in mail_handler - Added by Ingmar Heinrich about 9 years ago

Hi Thomas, could you be more verbose? I really would like to get this going.

RE: 422: Unprocessable Entity in mail_handler - Added by Thomas Lecavelier about 9 years ago

Try your setup without apache: you'll see that you're WebDAV will not bother you...

RE: 422: Unprocessable Entity in mail_handler - Added by George Crawford almost 9 years ago

I have the exact same error, but I don't understand any of the advice that Thomas Lecavelier gives. Can anyone help further on this problem?

RE: 422: Unprocessable Entity in mail_handler - Added by Henrique Bastos almost 9 years ago

I'm having this problem to. I'm running redmine from my local machine, so the url to access it is http://localhost:3000

Reading redmine's log redmine/log/production.log there is this entry:

Processing MailHandlerController#index (for 127.0.0.1 at 2009-03-02 12:30:57) [POST]
  Session ID: 7199ffdaa8111b282c52792d878660fa
  Parameters: {"action"=>"index", "allow_override"=>"", "issue"=>{"project"=>"myproject"}, 
"controller"=>"mail_handler", "key"=>"S66xCpNzSxfXYt4toiu9", 
"email"=>"From henrique@localhost  Mon Mar  2 12:30:57 2009\n
Return-Path: <henrique@localhost>\n
X-Original-To: redmine@locahost\n
Delivered-To: redmine@localhost\n
Received: from localhost (henriquebastos.localhost [127.0.0.1])\n
\tby localhost (Postfix) with SMTP id A37349D85C0\n
\tfor <redmine@localhost>; Mon,  2 Mar 2009 12:30:34 -0300 (BRT)\n
Subject: Test3\n
Message-Id: <20090302153045.A37349D85C0@localhost>\n
Date: Mon,  2 Mar 2009 12:30:34 -0300 (BRT)\n
From: henrique@localhost\n
To: undisclosed-recipients:;\n
\n
One more test3\n
"}
Completed in 0.00253 (394 reqs/sec) | Rendering: 0.00013 (5%) | DB: 0.00109 (42%) | 422 Unprocessable Entity [http://localhost/mail_handler]

The end of the log message says: 422 Unprocessable Entity [http://*localhost*/mail_handler]

Shouldn't it be http://localhost:3000/mail_handler ?

I'm sure that postfix is working properly.

I couldn't solve it yet, so I appreciate if anyone has a clue.

RE: 422: Unprocessable Entity in mail_handler - Added by Vladimir Merkulov over 8 years ago

Hi Henrique,

I had the same problem with 422 error, though my goal was somewhat different (I tried to make a direct HTTP POST call to my redmine installation from Java environment to create an issue).

I can suggest the following:
1) Make sure your message body ends with a "newline" symbol ('\n');
2) Try doing the following trick: specify Project and Tracker parameters in email body and make sure they are the last lines in the message, e.g. you should get something like

Processing MailHandlerController#index (for 127.0.0.1 at 2009-03-02 12:30:57) [POST]
  Session ID: 7199ffdaa8111b282c52792d878660fa
  Parameters: {"action"=>"index", "allow_override"=>"",  
"controller"=>"mail_handler", "key"=>"S66xCpNzSxfXYt4toiu9", 
"email"=>"From henrique@localhost  Mon Mar  2 12:30:57 2009\n
From: henrique@localhost\n
Subject: Test3\n
\n
One more test3\n
\n
Project: myproject\n
Tracker: bug\n
"}

Please, note the absence of "issue" HTTP parameter.
I do not know if these tricks are absolutely necessary neither do I imagine how they work, but this makes the job for me quite well and no more 422 errors

RE: 422: Unprocessable Entity in mail_handler - Added by Andi S about 8 years ago

i'm having the same issue.
This error only appears if mail is sent by an user which is not registered in System.
Any ideas how to solve that problem?

RE: 422: Unprocessable Entity in mail_handler - Added by The Great Milenko over 7 years ago

Not sure if this will help anyone.. but at least I'll have an answer to my own question when I look for it again ;)

Whatever the email address is that you are sending the mail from needs to exist and it needs to have access to the project that you are sending it to..

Here is an example for what we are using for qmail with vpopmail..

cat .qmail-redmine-projectname | /usr/local/vpopmail/domains/domain.com/rdm-mailhandler.rb --url https://support.domain.com/redmine/ --key 6lFFAHvxFASnh654321 --tracker=support --project=projectname

so sending an email to will try and inject it into redmine as a support tracker.

https://support.domain.com/redmine/settings?tab=authentication

self-registration: manual account activation

It might be b/c of the self-registration settings.. but I have not had time to play with it..

Again hope this helps someone..

Thanks for redmine ;)

(1-9/9)