mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-21 16:01:14 +00:00
Parse author's name enclosed in parentheses in the From field when creating a user account from an email (#17699).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17914 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
77f35cb818
commit
3ce803e82b
@ -544,12 +544,9 @@ class MailHandler < ActionMailer::Base
|
|||||||
# Creates a User for the +email+ sender
|
# Creates a User for the +email+ sender
|
||||||
# Returns the user or nil if it could not be created
|
# Returns the user or nil if it could not be created
|
||||||
def create_user_from_email
|
def create_user_from_email
|
||||||
from = email.header['from'].to_s
|
if from_addr = email.header['from'].try(:addrs).to_a.first
|
||||||
addr, name = from, nil
|
addr = from_addr.address
|
||||||
if m = from.match(/^"?(.+?)"?\s+<(.+@.+)>$/)
|
name = from_addr.display_name || from_addr.comments.to_a.first
|
||||||
addr, name = m[2], m[1]
|
|
||||||
end
|
|
||||||
if addr.present?
|
|
||||||
user = self.class.new_user_from_attributes(addr, name)
|
user = self.class.new_user_from_attributes(addr, name)
|
||||||
if handler_options[:no_notification]
|
if handler_options[:no_notification]
|
||||||
user.mail_notification = 'none'
|
user.mail_notification = 'none'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user