paperless icon indicating copy to clipboard operation
paperless copied to clipboard

Consumer rejects emails with Re: or Fwd: in subject

Open Whisprin opened this issue 5 years ago • 5 comments

I'm importing documents from an email inbox. However, email subjects containing "Fwd:" or "Re:" are considered unsafe and the email is not processed further.

The code for checking the subject is here: https://github.com/the-paperless-project/paperless/blob/2cd077d12d1f3046a02b9ed96f3acb4ac30e25cd/src/documents/mail.py#L108

The subject line is matched against SAFE_REGEX: https://github.com/the-paperless-project/paperless/blob/1c956652f360e58409c8fca148b7662585dd1087/src/documents/models.py#L160

If there are no objections I'm going to draft a PR to make unsafe subjects safe and then continue with the import. A similar suggestion has been made in: https://github.com/the-paperless-project/paperless/issues/506

Whisprin avatar Feb 06 '20 16:02 Whisprin

This might be problematic if you are spamed for any reason. I would advise against it. Why don't you change the subject before sending it?

ahyear avatar Feb 06 '20 21:02 ahyear

Sounds good to me. I don't see how colons or other punctuation make emails more unsafe than not having them in there.

Also, isn't the whole point of the PAPERLESS_EMAIL_SECRET to filter out emails that are not intended for paperless? The subject line shouldn't really matter as long as the secret is contained in the email I would think.

See paperless.conf.example

# Any email sent to the target account that does not contain this text will be
# ignored.
PAPERLESS_EMAIL_SECRET=""

What might work as well: have some logic to disregard the safe email subject when the email secret is set to a non-empty string.

ddddavidmartin avatar Feb 06 '20 22:02 ddddavidmartin

I agree that the spam issue is already solved by PAPERLESS_EMAIL_SECRET.

First, I would strip a set of common subject prefixes like "Fwd:" and then remove all non-safe characters from the subject.

Whisprin avatar Feb 10 '20 17:02 Whisprin

I would highly appreciate this! Would also second that the current situation is by no means a spam protection or similar

totti4ever avatar Apr 19 '20 18:04 totti4ever

Same, I'm trying to get emails from my scanner to go in but their subject is Transfer file from "Epson Connect Scan to Cloud"

It'd also be neat if it could not care and just take an entire email account, I setup a whole new email address for this purpose that all documents go to. If I cannot get this to work, I'll probably use OfflineIMAP to sync in all emails into the consume directory.

fabean avatar Apr 30 '20 12:04 fabean