diff --git a/src-ui/cypress/fixtures/mail_rules/mail_rules.json b/src-ui/cypress/fixtures/mail_rules/mail_rules.json index 7767940e7..5341b9cfa 100644 --- a/src-ui/cypress/fixtures/mail_rules/mail_rules.json +++ b/src-ui/cypress/fixtures/mail_rules/mail_rules.json @@ -9,6 +9,7 @@ "account": 2, "folder": "INBOX", "filter_from": null, + "filter_to": null, "filter_subject": "[paperless]", "filter_body": null, "filter_attachment_filename": null, diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html index ebb7458e6..b9802ea2a 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html +++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html @@ -18,6 +18,7 @@

Paperless will only process mails that match all of the filters specified below.

+ diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts index 25821242a..5e0ce49a7 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts @@ -149,6 +149,7 @@ export class MailRuleEditDialogComponent extends EditDialogComponent MailMessage: + + if to is None: + to = ["tosomeone@somewhere.com"] + email_msg = email.message.EmailMessage() # TODO: This does NOT set the UID email_msg["Message-ID"] = str(uuid.uuid4()) email_msg["Subject"] = subject email_msg["From"] = from_ + email_msg["To"] = str(" ,".join(to)) email_msg.set_content(body) # Either add some default number of attachments @@ -266,6 +281,7 @@ class TestMail(DirectoriesMixin, FileSystemAssertsMixin, TestCase): self.create_message( subject="Invoice 1", from_="amazon@amazon.de", + to=["me@myselfandi.com", "helpdesk@mydomain.com"], body="cables", seen=True, flagged=False, @@ -276,6 +292,7 @@ class TestMail(DirectoriesMixin, FileSystemAssertsMixin, TestCase): self.create_message( subject="Invoice 2", body="from my favorite electronic store", + to=["invoices@mycompany.com"], seen=False, flagged=True, processed=True, @@ -285,6 +302,7 @@ class TestMail(DirectoriesMixin, FileSystemAssertsMixin, TestCase): self.create_message( subject="Claim your $10M price now!", from_="amazon@amazon-some-indian-site.org", + to="special@me.me", seen=False, ), ) @@ -946,21 +964,26 @@ class TestMail(DirectoriesMixin, FileSystemAssertsMixin, TestCase): password="secret", ) - for (f_body, f_from, f_subject, expected_mail_count) in [ - (None, None, "Claim", 1), - ("electronic", None, None, 1), - (None, "amazon", None, 2), - ("cables", "amazon", "Invoice", 1), + for (f_body, f_from, f_to, f_subject, expected_mail_count) in [ + (None, None, None, "Claim", 1), + ("electronic", None, None, None, 1), + (None, "amazon", None, None, 2), + ("cables", "amazon", None, "Invoice", 1), + (None, None, "test@email.com", None, 0), + (None, None, "invoices@mycompany.com", None, 1), + ("electronic", None, "invoices@mycompany.com", None, 1), + (None, "amazon", "me@myselfandi.com", None, 1), ]: with self.subTest(f_body=f_body, f_from=f_from, f_subject=f_subject): MailRule.objects.all().delete() - rule = MailRule.objects.create( + _ = MailRule.objects.create( name="testrule3", account=account, action=MailRule.MailAction.DELETE, filter_subject=f_subject, filter_body=f_body, filter_from=f_from, + filter_to=f_to, ) self.reset_bogus_mailbox() self._queue_consumption_tasks_mock.reset_mock()