Defect #8714

mail-address parsing in app/models/mail_handler.rb (create_user_from_email) barks on names with Umlauts

Added by Heiko Wundram over 9 years ago. Updated about 1 month ago.

Status:ClosedStart date:2011-06-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-
Resolution:Cant reproduce Affected version:1.2.0

Description

The code in self.create_user_from_email in app/models/mail_handler.rb tries to intelligently parse the Email-"From:"-Address in a received mail into components which can be integrated into the new user object. For my specific case, I'm receiving a mail from a sender with umlauts (äöü) in the sender name (not the address, of course), which causes user.lastname to be assigned with an umlaut string. This (most probably) works correctly.

Comitting the new user which has a name assigned from this source fails, though, which in turn causes the mail to be rejected. I've traced the SQL statements that are executed (by turning on ActiveRecord logging), and can see that some of the validations of the user record object are executed (uniqueness of login and mail), but some test between then and the before_create-trigger fails, and causes the new user object to be rejected. I'm no Ruby/Rails whiz, and as such haven't found a debugging method to actually see which test causes the failure.

As a temporary workaround, I've unconditionally enabled the logic to set first/lastname from the local part of the mail address (which is used when the "Sender-Name" is absent), but: can anybody guide me how to actually enable enough logging to see what is failing here? Or, even better: derive a fix?

History

#1 Updated by Roland Discein about 9 years ago

+1

#2 Updated by Go MAEDA about 1 year ago

  • Status changed from New to Needs feedback

The following test works fine on Redmine 4.0. Does anyone still experience this issue?

Index: test/unit/mail_handler_test.rb
===================================================================
--- test/unit/mail_handler_test.rb    (リビジョン 18880)
+++ test/unit/mail_handler_test.rb    (作業コピー)
@@ -1157,7 +1157,8 @@
       ['jsmith@example.net', 'AVeryLongFirstnameThatExceedsTheMaximumLength Smith'] =>
          ['jsmith@example.net', 'AVeryLongFirstnameThatExceedsT', 'Smith'],
       ['jsmith@example.net', 'John AVeryLongLastnameThatExceedsTheMaximumLength'] =>
-         ['jsmith@example.net', 'John', 'AVeryLongLastnameThatExceedsTh']
+         ['jsmith@example.net', 'John', 'AVeryLongLastnameThatExceedsTh'],
+      ['jsmith@example.net', 'Frau Österreicher'] => ['jsmith@example.net', 'Frau', 'Österreicher']
     }
     to_test.each do |attrs, expected|
       user = MailHandler.new_user_from_attributes(attrs.first, attrs.last)

#3 Updated by Go MAEDA about 1 month ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Cant reproduce

Go MAEDA wrote:

The following test works fine on Redmine 4.0. Does anyone still experience this issue?

[...]

I cannot reproduce the issue with Redmine 3.4, 4.0, and 4.1. I think we can close this issue.

Also available in: Atom PDF