mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Enhancement: re-work mail rule dialog, support multiple include patterns (#7635)
This commit is contained in:
		@@ -137,7 +137,7 @@ These rules perform the following:
 | 
			
		||||
Paperless will check all emails only once and completely ignore messages
 | 
			
		||||
that do not match your filters. It will also only perform the rule action
 | 
			
		||||
on e-mails that it has consumed documents from. The filename attachment
 | 
			
		||||
exclusion pattern can include multiple patterns separated by a comma.
 | 
			
		||||
patterns can include wildcards and multiple patterns separated by a comma.
 | 
			
		||||
 | 
			
		||||
The actions all ensure that the same mail is not consumed twice by
 | 
			
		||||
different means. These are as follows:
 | 
			
		||||
 
 | 
			
		||||
@@ -560,7 +560,7 @@
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">51</context>
 | 
			
		||||
          <context context-type="linenumber">72</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html</context>
 | 
			
		||||
@@ -1648,7 +1648,7 @@
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">50</context>
 | 
			
		||||
          <context context-type="linenumber">71</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.html</context>
 | 
			
		||||
@@ -3650,162 +3650,166 @@
 | 
			
		||||
          <context context-type="linenumber">88</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5163375362523428079" datatype="html">
 | 
			
		||||
        <source>Rule order</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">16</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4086606389696938932" datatype="html">
 | 
			
		||||
        <source>Account</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">14</context>
 | 
			
		||||
          <context context-type="linenumber">19</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">68</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4348351765075925931" datatype="html">
 | 
			
		||||
        <source>Paperless will only process mails that match <x id="START_EMPHASISED_TEXT" ctype="x-em" equiv-text="<em>"/>all<x id="CLOSE_EMPHASISED_TEXT" ctype="x-em" equiv-text="</em>"/> of the criteria specified below.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">24</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7046259383943324039" datatype="html">
 | 
			
		||||
        <source>Folder</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">15</context>
 | 
			
		||||
          <context context-type="linenumber">26</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1391527525114848695" datatype="html">
 | 
			
		||||
        <source>Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">15</context>
 | 
			
		||||
          <context context-type="linenumber">26</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="101686279614365671" datatype="html">
 | 
			
		||||
        <source>Maximum age (days)</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">16</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7093509971705471817" datatype="html">
 | 
			
		||||
        <source>Attachment type</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">17</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="559099472394646919" datatype="html">
 | 
			
		||||
        <source>Consumption scope</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">18</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="56643687972548912" datatype="html">
 | 
			
		||||
        <source>See docs for .eml processing requirements</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">18</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5163375362523428079" datatype="html">
 | 
			
		||||
        <source>Rule order</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">19</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5488632521862493221" datatype="html">
 | 
			
		||||
        <source>Paperless will only process mails that match <x id="START_EMPHASISED_TEXT" ctype="x-em" equiv-text="<em>"/>all<x id="CLOSE_EMPHASISED_TEXT" ctype="x-em" equiv-text="</em>"/> of the filters specified below.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">22</context>
 | 
			
		||||
          <context context-type="linenumber">27</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6925928412364847639" datatype="html">
 | 
			
		||||
        <source>Filter from</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">23</context>
 | 
			
		||||
          <context context-type="linenumber">30</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8977094263269822022" datatype="html">
 | 
			
		||||
        <source>Filter to</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">24</context>
 | 
			
		||||
          <context context-type="linenumber">31</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8497813481090627874" datatype="html">
 | 
			
		||||
        <source>Filter subject</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">25</context>
 | 
			
		||||
          <context context-type="linenumber">32</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7314357616097563149" datatype="html">
 | 
			
		||||
        <source>Filter body</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">26</context>
 | 
			
		||||
          <context context-type="linenumber">33</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4603548543464136402" datatype="html">
 | 
			
		||||
        <source>Filter attachment filename includes</source>
 | 
			
		||||
      <trans-unit id="559099472394646919" datatype="html">
 | 
			
		||||
        <source>Consumption scope</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">27</context>
 | 
			
		||||
          <context context-type="linenumber">39</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4245210767172267486" datatype="html">
 | 
			
		||||
        <source>Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive.</source>
 | 
			
		||||
      <trans-unit id="56643687972548912" datatype="html">
 | 
			
		||||
        <source>See docs for .eml processing requirements</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">27</context>
 | 
			
		||||
          <context context-type="linenumber">39</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6869675473865305593" datatype="html">
 | 
			
		||||
        <source>Filter attachment filename excluding</source>
 | 
			
		||||
      <trans-unit id="7093509971705471817" datatype="html">
 | 
			
		||||
        <source>Attachment type</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">28</context>
 | 
			
		||||
          <context context-type="linenumber">40</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6774472763442688477" datatype="html">
 | 
			
		||||
        <source>Do not consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive.</source>
 | 
			
		||||
      <trans-unit id="2873939123535615966" datatype="html">
 | 
			
		||||
        <source>Include only files matching</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">28</context>
 | 
			
		||||
          <context context-type="linenumber">43</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7233407036155150477" datatype="html">
 | 
			
		||||
        <source>Optional. Wildcards e.g. *.pdf or *invoice* allowed. Can be comma-separated list. Case insensitive.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">43</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">44</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1546332577833742677" datatype="html">
 | 
			
		||||
        <source>Exclude files matching</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">44</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="9216117865911519658" datatype="html">
 | 
			
		||||
        <source>Action</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">31</context>
 | 
			
		||||
          <context context-type="linenumber">50</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4274038999388817994" datatype="html">
 | 
			
		||||
        <source>Action is only performed when documents are consumed from the mail. Mails without attachments remain entirely untouched.</source>
 | 
			
		||||
      <trans-unit id="7841986067387421166" datatype="html">
 | 
			
		||||
        <source>Only performed if the mail is processed.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">31</context>
 | 
			
		||||
          <context context-type="linenumber">50</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1261794314435932203" datatype="html">
 | 
			
		||||
        <source>Action parameter</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">33</context>
 | 
			
		||||
          <context context-type="linenumber">52</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6093797930511670257" datatype="html">
 | 
			
		||||
        <source>Assign title from</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">35</context>
 | 
			
		||||
          <context context-type="linenumber">54</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5232720756589450549" datatype="html">
 | 
			
		||||
        <source>Assign owner from rule</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">55</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6695990587380209737" datatype="html">
 | 
			
		||||
        <source>Assign document type</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">37</context>
 | 
			
		||||
          <context context-type="linenumber">59</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
 | 
			
		||||
@@ -3816,32 +3820,25 @@
 | 
			
		||||
        <source>Assign correspondent from</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">38</context>
 | 
			
		||||
          <context context-type="linenumber">60</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="4875491778188965469" datatype="html">
 | 
			
		||||
        <source>Assign correspondent</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">40</context>
 | 
			
		||||
          <context context-type="linenumber">62</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">163</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5232720756589450549" datatype="html">
 | 
			
		||||
        <source>Assign owner from rule</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">42</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1519954996184640001" datatype="html">
 | 
			
		||||
        <source>Error</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html</context>
 | 
			
		||||
          <context context-type="linenumber">48</context>
 | 
			
		||||
          <context context-type="linenumber">69</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
 | 
			
		||||
 
 | 
			
		||||
@@ -10,36 +10,57 @@
 | 
			
		||||
  <div class="modal-body">
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <div class="col-md-4">
 | 
			
		||||
        <pngx-input-text i18n-title title="Name" formControlName="name" [error]="error?.name" autocomplete="off"></pngx-input-text>
 | 
			
		||||
        <pngx-input-select i18n-title title="Account" [items]="accounts" formControlName="account"></pngx-input-select>
 | 
			
		||||
        <pngx-input-text i18n-title title="Folder" formControlName="folder" i18n-hint hint="Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server." [error]="error?.folder"></pngx-input-text>
 | 
			
		||||
        <pngx-input-number i18n-title title="Maximum age (days)" formControlName="maximum_age" [showAdd]="false" [error]="error?.maximum_age"></pngx-input-number>
 | 
			
		||||
        <pngx-input-select i18n-title title="Attachment type" [items]="attachmentTypeOptions" formControlName="attachment_type"></pngx-input-select>
 | 
			
		||||
        <pngx-input-select i18n-title title="Consumption scope" [items]="consumptionScopeOptions" formControlName="consumption_scope" i18n-hint hint="See docs for .eml processing requirements"></pngx-input-select>
 | 
			
		||||
        <pngx-input-number i18n-title title="Rule order" formControlName="order" [showAdd]="false" [error]="error?.order"></pngx-input-number>
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Name" formControlName="name" [error]="error?.name" autocomplete="off"></pngx-input-text>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-md-4">
 | 
			
		||||
        <p class="small" i18n>Paperless will only process mails that match <em>all</em> of the filters specified below.</p>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter from" formControlName="filter_from" [error]="error?.filter_from"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter to" formControlName="filter_to" [error]="error?.filter_to"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter subject" formControlName="filter_subject" [error]="error?.filter_subject"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter body" formControlName="filter_body" [error]="error?.filter_body"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter attachment filename includes" formControlName="filter_attachment_filename_include" i18n-hint hint="Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_attachment_filename_include"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text i18n-title title="Filter attachment filename excluding" formControlName="filter_attachment_filename_exclude" i18n-hint hint="Do not consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_attachment_filename_exclude"></pngx-input-text>
 | 
			
		||||
        <pngx-input-number [horizontal]="true" i18n-title title="Rule order" formControlName="order" [showAdd]="false" [error]="error?.order"></pngx-input-number>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-md-4">
 | 
			
		||||
        <pngx-input-select i18n-title title="Action" [items]="actionOptions" formControlName="action" i18n-hint hint="Action is only performed when documents are consumed from the mail. Mails without attachments remain entirely untouched."></pngx-input-select>
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Account" [items]="accounts" formControlName="account"></pngx-input-select>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <hr class="mt-0"/>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <p class="small" i18n>Paperless will only process mails that match <em>all</em> of the criteria specified below.</p>
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Folder" formControlName="folder" i18n-hint hint="Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server." [error]="error?.folder"></pngx-input-text>
 | 
			
		||||
        <pngx-input-number [horizontal]="true" i18n-title title="Maximum age (days)" formControlName="maximum_age" [showAdd]="false" [error]="error?.maximum_age"></pngx-input-number>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Filter from" formControlName="filter_from" [error]="error?.filter_from"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Filter to" formControlName="filter_to" [error]="error?.filter_to"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Filter subject" formControlName="filter_subject" [error]="error?.filter_subject"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Filter body" formControlName="filter_body" [error]="error?.filter_body"></pngx-input-text>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <hr class="mt-0"/>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Consumption scope" [items]="consumptionScopeOptions" formControlName="consumption_scope" i18n-hint hint="See docs for .eml processing requirements"></pngx-input-select>
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Attachment type" [items]="attachmentTypeOptions" formControlName="attachment_type"></pngx-input-select>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Include only files matching" formControlName="filter_attachment_filename_include" i18n-hint hint="Optional. Wildcards e.g. *.pdf or *invoice* allowed. Can be comma-separated list. Case insensitive." [error]="error?.filter_attachment_filename_include"></pngx-input-text>
 | 
			
		||||
        <pngx-input-text [horizontal]="true" i18n-title title="Exclude files matching" formControlName="filter_attachment_filename_exclude" i18n-hint hint="Optional. Wildcards e.g. *.pdf or *invoice* allowed. Can be comma-separated list. Case insensitive." [error]="error?.filter_attachment_filename_exclude"></pngx-input-text>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <hr class="mt-0"/>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Action" [items]="actionOptions" formControlName="action" i18n-hint hint="Only performed if the mail is processed."></pngx-input-select>
 | 
			
		||||
        @if (showActionParamField) {
 | 
			
		||||
          <pngx-input-text i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></pngx-input-text>
 | 
			
		||||
          <pngx-input-text [horizontal]="true" i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></pngx-input-text>
 | 
			
		||||
        }
 | 
			
		||||
        <pngx-input-select i18n-title title="Assign title from" [items]="metadataTitleOptions" formControlName="assign_title_from"></pngx-input-select>
 | 
			
		||||
        <pngx-input-tags [allowCreate]="false" formControlName="assign_tags"></pngx-input-tags>
 | 
			
		||||
        <pngx-input-select i18n-title title="Assign document type" [items]="documentTypes" [allowNull]="true" formControlName="assign_document_type"></pngx-input-select>
 | 
			
		||||
        <pngx-input-select i18n-title title="Assign correspondent from" [items]="metadataCorrespondentOptions" formControlName="assign_correspondent_from"></pngx-input-select>
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Assign title from" [items]="metadataTitleOptions" formControlName="assign_title_from"></pngx-input-select>
 | 
			
		||||
        <pngx-input-check [horizontal]="true" i18n-title title="Assign owner from rule" formControlName="assign_owner_from_rule"></pngx-input-check>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <pngx-input-tags [horizontal]="true" [allowCreate]="false" formControlName="assign_tags"></pngx-input-tags>
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Assign document type" [items]="documentTypes" [allowNull]="true" formControlName="assign_document_type"></pngx-input-select>
 | 
			
		||||
        <pngx-input-select [horizontal]="true" i18n-title title="Assign correspondent from" [items]="metadataCorrespondentOptions" formControlName="assign_correspondent_from"></pngx-input-select>
 | 
			
		||||
        @if (showCorrespondentField) {
 | 
			
		||||
          <pngx-input-select i18n-title title="Assign correspondent" [items]="correspondents" [allowNull]="true" formControlName="assign_correspondent"></pngx-input-select>
 | 
			
		||||
          <pngx-input-select [horizontal]="true" i18n-title title="Assign correspondent" [items]="correspondents" [allowNull]="true" formControlName="assign_correspondent"></pngx-input-select>
 | 
			
		||||
        }
 | 
			
		||||
        <pngx-input-check i18n-title title="Assign owner from rule" formControlName="assign_owner_from_rule"></pngx-input-check>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -686,6 +686,25 @@ class MailAccountHandler(LoggingMixin):
 | 
			
		||||
 | 
			
		||||
        return processed_elements
 | 
			
		||||
 | 
			
		||||
    def filename_inclusion_matches(
 | 
			
		||||
        self,
 | 
			
		||||
        filter_attachment_filename_include: Optional[str],
 | 
			
		||||
        filename: str,
 | 
			
		||||
    ) -> bool:
 | 
			
		||||
        if filter_attachment_filename_include:
 | 
			
		||||
            filter_attachment_filename_inclusions = (
 | 
			
		||||
                filter_attachment_filename_include.split(",")
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
            # Force the filename and pattern to the lowercase
 | 
			
		||||
            # as this is system dependent otherwise
 | 
			
		||||
            filename = filename.lower()
 | 
			
		||||
            for filename_include in filter_attachment_filename_inclusions:
 | 
			
		||||
                if filename_include and fnmatch(filename, filename_include.lower()):
 | 
			
		||||
                    return True
 | 
			
		||||
            return False
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
    def filename_exclusion_matches(
 | 
			
		||||
        self,
 | 
			
		||||
        filter_attachment_filename_exclude: Optional[str],
 | 
			
		||||
@@ -728,9 +747,9 @@ class MailAccountHandler(LoggingMixin):
 | 
			
		||||
                )
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
            if rule.filter_attachment_filename_include and not fnmatch(
 | 
			
		||||
                att.filename.lower(),
 | 
			
		||||
                rule.filter_attachment_filename_include.lower(),
 | 
			
		||||
            if not self.filename_inclusion_matches(
 | 
			
		||||
                rule.filter_attachment_filename_include,
 | 
			
		||||
                att.filename,
 | 
			
		||||
            ):
 | 
			
		||||
                # Force the filename and pattern to the lowercase
 | 
			
		||||
                # as this is system dependent otherwise
 | 
			
		||||
 
 | 
			
		||||
@@ -658,6 +658,12 @@ class TestMail(
 | 
			
		||||
                exclude_pattern=None,
 | 
			
		||||
                expected_matches=["f2.png"],
 | 
			
		||||
            ),
 | 
			
		||||
            FilterTestCase(
 | 
			
		||||
                "PDF Files with f2 and f3",
 | 
			
		||||
                include_pattern="f2.pdf,f3*",
 | 
			
		||||
                exclude_pattern=None,
 | 
			
		||||
                expected_matches=["f2.pdf", "f3.pdf"],
 | 
			
		||||
            ),
 | 
			
		||||
            FilterTestCase(
 | 
			
		||||
                "PDF Files without f1",
 | 
			
		||||
                include_pattern="*.pdf",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user