Fixed issue #2245 - Unable to process spam mail with invalid date field.
This commit is contained in:
parent
45fee1b752
commit
9a7118123d
3 changed files with 37 additions and 2 deletions
|
@ -495,9 +495,13 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
.transform_values { |v| v.match?(EMAIL_REGEX) ? v : '' })
|
.transform_values { |v| v.match?(EMAIL_REGEX) ? v : '' })
|
||||||
|
|
||||||
h['x-any-recipient'] = h.values.select(&:present?).join(', ')
|
h['x-any-recipient'] = h.values.select(&:present?).join(', ')
|
||||||
h['date'] = Time.zone.parse(mail.date.to_s) || imported_fields['date']
|
|
||||||
h['message_id'] = imported_fields['message-id']
|
h['message_id'] = imported_fields['message-id']
|
||||||
h['subject'] = imported_fields['subject']&.sub(/^=\?us-ascii\?Q\?(.+)\?=$/, '\1')
|
h['subject'] = imported_fields['subject']&.sub(/^=\?us-ascii\?Q\?(.+)\s*\?=\s*$/, '\1')
|
||||||
|
begin
|
||||||
|
h['date'] = Time.zone.parse(mail.date.to_s) || imported_fields['date']
|
||||||
|
rescue
|
||||||
|
h['date'] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
[imported_fields, raw_fields, custom_fields].reduce({}.with_indifferent_access, &:merge)
|
[imported_fields, raw_fields, custom_fields].reduce({}.with_indifferent_access, &:merge)
|
||||||
|
|
15
test/data/mail/mail074.box
Normal file
15
test/data/mail/mail074.box
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
From: Martin Edenhofer <martin@example.de>
|
||||||
|
Subject: Test with different content type file name options
|
||||||
|
Date: Wed, 05 Sep 2018 29:24:05 +0700
|
||||||
|
Message-Id: <4C4ECFBF-BA12-46D9-A407-8E873F20DEF3X@example.de>
|
||||||
|
To: me@example.de
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=us-ascii
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
-Martin
|
||||||
|
|
||||||
|
--
|
||||||
|
Old programmers never die. They just branch to a new address.
|
16
test/data/mail/mail074.yml
Normal file
16
test/data/mail/mail074.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
||||||
|
from: Martin Edenhofer <martin@example.de>
|
||||||
|
from_email: martin@example.de
|
||||||
|
from_display_name: Martin Edenhofer
|
||||||
|
date:
|
||||||
|
to: me@example.de
|
||||||
|
subject: Test with different content type file name options
|
||||||
|
body: |
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
-Martin
|
||||||
|
|
||||||
|
--
|
||||||
|
Old programmers never die. They just branch to a new address.
|
||||||
|
content_type: text/plain
|
||||||
|
attachments: []
|
Loading…
Reference in a new issue