diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 5f00238e4..d61131fa8 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -75,8 +75,13 @@ class Channel::EmailParser # set all headers mail.header.fields.select(&:name).each { |field| + # full line, encode, ready for storage - data[field.name.to_s.downcase.to_sym] = Encode.conv('utf8', field.to_s) + begin + data[field.name.to_s.downcase.to_sym] = Encode.conv('utf8', field.to_s) + rescue => e + data[field.name.to_s.downcase.to_sym] = e.message + end # if we need to access the lines by objects later again data["raw-#{field.name.downcase}".to_sym] = field diff --git a/test/unit/email_process_test.rb b/test/unit/email_process_test.rb index b7dd2e5b0..a4b1b9afc 100644 --- a/test/unit/email_process_test.rb +++ b/test/unit/email_process_test.rb @@ -1865,6 +1865,57 @@ AElFTkSuQmCC { data: 'From: Some Body To: Bob +Cc: any+1@example.com +Subject: some subject 2 +Keywords: +In-Reply-To: <20170307172822.1233.623846@example.zammad.com> +Accept-Language: de-DE, en-US +Content-Language: de-DE +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +x-originating-ip: [1.1.2.2] + +Some Text', + channel: { + trusted: false, + }, + success: true, + result: { + 0 => { + group: 'Users', + priority: '2 normal', + title: 'some subject 2', + }, + 1 => { + sender: 'Customer', + type: 'email', + }, + }, + verify: { + users: [ + { + firstname: 'Some', + lastname: 'Body', + email: 'somebody@example.com', + }, + { + firstname: 'Bob', + lastname: '', + fullname: 'Bob', + email: 'bod@example.com', + }, + { + firstname: '', + lastname: '', + email: 'any+1@example.com', + fullname: 'any+1@example.com', + }, + ], + } + }, + { + data: 'From: Some Body +To: Bob Cc: any@example.com Subject: some subject