17699-fix-using-mail-address-object.diff

Go MAEDA, 2019-02-16 04:38

Download (773 Bytes)

View differences:

app/models/mail_handler.rb (working copy)
536 536
  # Creates a User for the +email+ sender
537 537
  # Returns the user or nil if it could not be created
538 538
  def create_user_from_email
539
    from = email.header['from'].to_s
540
    addr, name = from, nil
541
    if m = from.match(/^"?(.+?)"?\s+<(.+@.+)>$/)
542
      addr, name = m[2], m[1]
543
    end
539
    from_addr = email.header['from'].addrs.first
540
    addr = from_addr.address
541
    name = from_addr.display_name || from_addr.comments.first
544 542
    if addr.present?
545 543
      user = self.class.new_user_from_attributes(addr, name)
546 544
      if handler_options[:no_notification]