create_mail_rule
Set up automated mail processing in Paperless-ngx by defining which incoming emails and attachments to import, then assigning tags, correspondents, document types, and actions to the resulting documents.
Instructions
Create a mail rule on a mail account: which folder and mails to consider, which attachments to import, and what to assign to the resulting documents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| order | No | Rules run in ascending order | |
| owner | No | ||
| action | No | What happens to processed mail: 1=delete, 2=move to action_parameter folder, 3=mark as read (default), 4=flag, 5=tag with action_parameter | |
| folder | No | IMAP folder (default INBOX); subfolders use the server's delimiter, e.g. INBOX.Invoices | |
| account | Yes | Mail account ID | |
| enabled | No | ||
| filter_to | No | ||
| pdf_layout | No | Mail-to-PDF layout: 0=system default, 1=text then HTML, 2=HTML then text, 3=HTML only, 4=text only | |
| assign_tags | No | ||
| filter_body | No | ||
| filter_from | No | ||
| maximum_age | No | Only mails younger than this many days (default 30) | |
| filter_subject | No | ||
| attachment_type | No | 1=attachments only (default), 2=all files including inline | |
| stop_processing | No | Skip later rules once this rule queued a document | |
| action_parameter | No | ||
| assign_title_from | No | 1=mail subject (default), 2=attachment filename, 3=don't assign | |
| consumption_scope | No | 1=attachments only (default), 2=whole mail as .eml, 3=.eml plus attachments as separate documents | |
| assign_correspondent | No | ||
| assign_document_type | No | ||
| assign_owner_from_rule | No | ||
| assign_correspondent_from | No | 1=don't assign (default), 2=sender mail address, 3=sender name (falls back to address), 4=the correspondent in assign_correspondent. ⚠️ 2 and 3 CREATE a new correspondent for every distinct sender string — the usual cause of duplicate correspondents. Prefer 4, or 1 plus matching rules on existing correspondents. | |
| filter_attachment_filename_exclude | No | Skip attachments whose whole filename matches | |
| filter_attachment_filename_include | No | Only attachments whose whole filename matches, e.g. *.pdf |