422 Unprocessable Entity - can't resolve
Added by Pawel Skocz over 13 years ago
Hi, I need help with emails sent to my redmine. I'm using rdm-mailhandler.rb and want to create account when user is not registered. My settings are:
redmine: 1.01
/etc/aliases:online: "|/usr/local/lib/redmine-1.0.1/extra/mail_handler/rdm-mailhandler.rb --verbose --url https://domain.com --project xxxxxx --unknown-user=create --tracker bug --key xxxxxx --allow-override project,tracker,category,priority --no-permission-check"
Debug log:
@Processing MailHandlerController#index (for xx.xx.xx.xx at 2011-01-31 15:38:47) [POST]
Parameters: {"no_permission_check"=>"1", "unknown_user"=>"create", "allow_override"=>"project,tracker,category,priority", "issue"=>{"project"=>"xxxxxxx", "tracker"=>"bug"}, "key"=>"xxxxxx", "email"=>"From xxxx@xxxxx.xx Mon Jan 31 15:38:46 2011\nReceived: from [xx.xx.xx.xx] (helo=mail.domain.com)\n\tby xxxxxx with esmtp (Exim 4.69)\n\t(envelope-from <xxxxx@xxxxx.xx>)\n\tid 1Pjuty-0006TQ-Mr\n\tfor xxxxxx@xxxxxxxxx.xx; Mon, 31 Jan 2011 15:38:46 +0100\nReceived: from mail-fx0-f43.google.com ([209.85.161.43])\n\tby xxxxxx.xxxxxx.xx with esmtp (Exim 4.69)\n\t(envelope-from <xxxxx@xxxx.xx>)\n\tid 1Pjutt-0001JW-Kw\n\tfor xxxxxx@xxxxxxxxx.xx; Mon, 31 Jan 2011 15:38:41 +0100\nReceived: by fxm18 with SMTP id 18so5791093fxm.16\n for <xxxxxx@xxxxxxxxx.xx>; Mon, 31 Jan 2011 06:38:36 0800 (PST)\nReceived: by xxx.xxx.xxx.xxx with SMTP id f6mr3426751fal.1.1296484716054; Mon,\n 31 Jan 2011 06:38:36 0800 (PST)\nMIME-Version: 1.0\nReceived: by xxx.xxx.xxx.xxx with HTTP; Mon, 31 Jan 2011 06:38:15 0800 (PST)\nX-Originating-IP: [xxx.xxx.xxx.xxx]\nFrom: =?UTF-xxxxxxxxxxxx?= <xxxxx@xxxx.xx>\nDate: Mon, 31 Jan 2011 15:38:15 +0100\nMessage-ID: <AANLkTikoDSr3Ecu1-mCPpake+BQayS=MfU_YQ7FQK8U0@mail.gmail.com>\nSubject: test\nTo: xxxxxx <xxxxxx@xxxxxxxxx.xx>\nContent-Type: text/plain; charset=UTF-8\n\nasas\n\n-- \nxxxxxxxx\n\n\n"}
Received mail:
From xxxx@xxxx.xxx Mon Jan 31 15:38:46 2011
Received: from [xx.xx.xx.xx] (helo=mail.domain.com)
by xxxxx.xx with esmtp (Exim 4.69)
(envelope-from <xxxxx@xxx.xx>)
id 1Pjuty-0006TQ-Mr
for xxxxxx@xxxxxxxxx.xx; Mon, 31 Jan 2011 15:38:46 +0100
Received: from mail-fx0-f43.google.com ([209.85.161.43])
by xxxxx.xxxxxxxx.xx with esmtp (Exim 4.69)
(envelope-from <xxxx@xxxx.xx>)
id 1Pjutt-0001JW-Kw
for xxxxxx@xxxxxx.xx; Mon, 31 Jan 2011 15:38:41 +0100
Received: by fxm18 with SMTP id 18so5791093fxm.16
for <xxxx@xxxxxxx.xx>; Mon, 31 Jan 2011 06:38:36 -0800 (PST)
Received: by xxx.xxx.xxx.xxx with SMTP id f6mr3426751fal.1.1296484716054; Mon,
31 Jan 2011 06:38:36 -0800 (PST)
MIME-Version: 1.0
Received: by xxx.xxx.xx.xx with HTTP; Mon, 31 Jan 2011 06:38:15 -0800 (PST)
X-Originating-IP: [xxx.xxx.xxxx.xxx]
From: =?UTF-8?B?UGF3ZcWCIF2rb223?= <xxx.xxx.xxx.xx>
Date: Mon, 31 Jan 2011 15:38:15 +0100
Message-ID: <AANLkTikoDSr3Ecu1-mCPpake+BQayS=MfU_YQ7FQK8U0@mail.gmail.com>
Subject: test
To: xxxxx <xxxxxx@xxxxxxxxx.xx>
Content-Type: text/plain; charset=UTF-8
asas
User Load (0.3ms) SELECT * FROM `users` WHERE (LOWER(mail) = 'xxxxx@xxxxx.xx') AND ( (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' ) ) LIMIT 1
SQL (0.1ms) BEGIN
CustomField Load (0.2ms) SELECT * FROM `custom_fields` WHERE (type = 'UserCustomField') ORDER BY position
User Load (0.3ms) SELECT `users`.id FROM `users` WHERE (LOWER(`users`.`login`) = BINARY 'xxxxx@xxxxx.xx') AND ( (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' ) ) LIMIT 1
User Load (0.2ms) SELECT `users`.id FROM `users` WHERE (LOWER(`users`.`mail`) = BINARY 'xxxxx@xxxxx.xx') AND ( (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' ) ) LIMIT 1
SQL (0.2ms) ROLLBACK
MailHandler: could not create account for [xxxxx@xxxxx.xx]
Completed in 15ms (View: 1, DB: 1) | 422 Unprocessable Entity [https://domain.com/mail_handler]
@
Strange is, that some accounts are created, and some are not. I can't find what's cause of this behaviour.
Replies (1)
RE: 422 Unprocessable Entity - can't resolve [SOLVED]
-
Added by Pawel Skocz over 13 years ago
Problem seems to be fixed.
I've found, that 'login' field in the database table 'users' is VARCHAR, same as in file app/models/user.rb, where there is a check, if login has no more than 30 characters.
validates_length_of :login, :maximum => 30
Unfortunately, senders email had more caracters (34).
After changing it to 60 everything started to work.