Project

General

Profile

Defect #10334 ยป redmine-mail-from-unquote.patch

Patch to unquote user name in From-header in received emails - Lauri Tirkkonen, 2012-02-28 15:50

View differences:

app/models/mail_handler.rb
15 15
# along with this program; if not, write to the Free Software
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 17

  
18
require 'tmail'
19

  
18 20
class MailHandler < ActionMailer::Base
19 21
  include ActionView::Helpers::SanitizeHelper
20 22
  include Redmine::I18n
......
359 361
  def create_user_from_email(email)
360 362
    addr = email.from_addrs.to_a.first
361 363
    if addr && !addr.spec.blank?
362
      user = self.class.new_user_from_attributes(addr.spec, addr.name)
364
      user = self.class.new_user_from_attributes(addr.spec, TMail::Unquoter.unquote_and_convert_to(addr.name, 'utf-8'))
363 365
      if user.save
364 366
        user
365 367
      else
    (1-1/1)