Improved email processing on invalid/not parseable headers.
This commit is contained in:
parent
6d808ff3eb
commit
a67019ecb8
2 changed files with 57 additions and 1 deletions
|
@ -75,8 +75,13 @@ class Channel::EmailParser
|
||||||
|
|
||||||
# set all headers
|
# set all headers
|
||||||
mail.header.fields.select(&:name).each { |field|
|
mail.header.fields.select(&:name).each { |field|
|
||||||
|
|
||||||
# full line, encode, ready for storage
|
# full line, encode, ready for storage
|
||||||
|
begin
|
||||||
data[field.name.to_s.downcase.to_sym] = Encode.conv('utf8', field.to_s)
|
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
|
# if we need to access the lines by objects later again
|
||||||
data["raw-#{field.name.downcase}".to_sym] = field
|
data["raw-#{field.name.downcase}".to_sym] = field
|
||||||
|
|
|
@ -1865,6 +1865,57 @@ AElFTkSuQmCC
|
||||||
{
|
{
|
||||||
data: 'From: Some Body <somebody@example.com>
|
data: 'From: Some Body <somebody@example.com>
|
||||||
To: Bob <bod@example.com>
|
To: Bob <bod@example.com>
|
||||||
|
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 <somebody@example.com>
|
||||||
|
To: Bob <bod@example.com>
|
||||||
Cc: any@example.com
|
Cc: any@example.com
|
||||||
Subject: some subject
|
Subject: some subject
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue