Vote #75502
完了Parse author's name enclosed in parentheses in the From field when creating a user account from an email
0%
説明
Emails header "From" can be not only in angles format, like this:
From: John Doe john.doe@company.mailbut also in parentheses format, like this:
From: john.doe@company.mail (John Doe)For example sendmail from postfix does this when using switch -F.
The patch to fix this is attached.
journals
Please add test.
source:trunk/test/unit/mail_handler_test.rb
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I wrote a new patch. The code using @Mail::Address@ is shorter and maybe more reliable (I hope) than the code using our regular expressions.
Patches to commit:
* attachment:17699-fix-using-mail-address-object.diff
* attachment:email_from_parens_format_test.diff
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Updated the patch. @email.header['from']@ can be nil or @Mail::UnstructuredField@ object (does not have @addrs@ method).
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Updated the patch again. @from_addr.comments@ also can be nil.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------