Project

General

Profile

Actions

Feature #19289

open

Exclude attachments from incoming emails based on file content or file hash

Added by Mikhail Voronyuk over 9 years ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

We have a problem similar to #3413, i.e. if we create tickets via email there a lot of signature images will get Redmine attachments.
But the difference is that in our company we use IBM Notes thick and web-clients so
  1. the signature images and the inline images (e.g. user screenshots that Printscreen and Ctrl+V into email body) in each new email have different names
  2. there is no way to distinguish the inline images from the signature images by name/size (sometimes useful user screenshot may be less that signature image in size) or other tags in email body
  3. a similar image that is presented in forwarded email several times has multiple names but similar size and similar binary

Here they are:
!2015-03-06 10-37-50.png!
!2015-03-06 10-41-03.png!

I know that there is a way in Redmine to filter attachments by file mask. As you can see it is useless in this case.
Also we want to leave useful inline images because we can not ask users to do not paste the printscreens into the email body directly and to save at first the screenshot as a file and attach screenshot as file (in that case for the user it is simpler to do not report a bug than to do this:) ). So the patch mail_handler_ignore_inline_attachments_patch in #3413 useless for us too.

I thought to create a list of ignored attachments (e.g. directory in redmine server with all possible signature images files or file hashes list) and write a patch that will compare binary or hash of each new email attachment with the ignored list. But I'm a newbie in Ruby and I will appreciate any help.

I guess that the patch should be in the app/models/mail_handler.rb in accept_attachment? subroutine and should use FileUtils.cmp for comparing. But I have no idea what contained in attachment.decoded and how do I compare it to master copy.


Files

2015-03-06 10-41-03.png (35.6 KB) 2015-03-06 10-41-03.png using IBM Notes thick client Mikhail Voronyuk, 2015-03-06 08:49
2015-03-06 10-37-50.png (36.5 KB) 2015-03-06 10-37-50.png using IBM iNotes web client Mikhail Voronyuk, 2015-03-06 08:49
0001-Filter-email-attachments-based-on-content-ignore-fil.patch (1.3 KB) 0001-Filter-email-attachments-based-on-content-ignore-fil.patch Mikhail Voronyuk, 2015-03-08 09:09

Related issues

Related to Redmine - Patch #25215: Re-use existing identical disk files for new attachmentsClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF