Mail Attachment DownloaderVersion 4.0Version 3.x

Customizing file names or email data using fields

Build folder and file names from email fields such as {FILENAME}, {ID}, the sender and the date, with date formats and examples.

The Fields window open under a rule's File name box: a search box, the columns Field, Holds and For a sample email, {EMAIL_FROM} selected and the Insert button

Mail Attachment Downloader names the files it saves from fields: short names in curly braces, such as {SUBJECT} or {DATE[yyyy-MM-dd]}, that are filled in from each email. This post lists the fields of version 4.0, shows how to change their output, and gives a few examples.

Where you can use fields

  • A rule’s folder and file name (PRO Rules Client and PRO Rules Server): the Save folder and File name boxes of the rule’s Save part, in the Rule Editor.
  • The text of a rule’s steps: for example the file and columns of Save metadata, the subject and text of Send an email, or the file name of Merge PDFs.
  • The Parser’s output (PRO Parser and up): its folder and file name can use the values the Parser reads, such as {SUPPLIER}\{INVOICE_NUMBER}_{FILENAME}{EXT}. See folders and file names.

The Free edition and PRO Backup name files with tick boxes instead: on the Account rule tab, the Folders and file names page has Saved file name with Filename, From, Subject, Date and ID, to make each name unique.

How to open the field list

Click the Fields… button next to a box. The Fields window lists each field, what it holds, and its value for a sample email. Type in the search box (for example “date” or “sender”) to find a field, then click Insert to put it where the cursor is. Fields: help explains more.

The Fields window open under a rule's File name box: a search box, the columns Field, Holds and For a sample email, {EMAIL_FROM} selected and the Insert button
Fields…: every field the box can use, with its value for a sample email.

The list only offers the fields that make sense in that box. A rule’s File name can’t use the saved file’s own fields, such as {SAVE_PATH}, because the file isn’t saved yet.

The default file name: {FILENAME}_{ID}{EXT}

A new rule starts with this file name:

{FILENAME}_{ID}{EXT}

  • {FILENAME}: the file’s name, without its extension.
  • {ID}: the message’s ID with the part number, so each file’s name is different.
  • {EXT}: the file’s extension, with the dot, such as .pdf.

So invoice.pdf is saved as something like invoice_00000_1.2.pdf. Keep {ID} in your file names: two emails often send files with the same name (invoice.pdf, scan.pdf), and {ID} keeps them apart. Use {FILENAMEEXT} for the name with its extension, but not together with {FILENAME} and {EXT}, or part of the name comes twice.

The Save part of a rule with the default file name {FILENAME}_{ID}{EXT} and an example of the saved file's path below it
A new rule’s file name, with an example of the result below the box.

The fields

The email

  • {FROM}, {TO}, {CC}: who sent it, who it was sent to and copied to, with the names.
  • {EMAIL_FROM}, {EMAIL_TO}, {EMAIL_CC}: the addresses only (several are separated by commas).
  • {SUBJECT}: the subject.
  • {IMPORTANCE}: HIGH, NORMAL or LOW.
  • {EMAIL_HEADER[...]}: any header of the email (more below).
  • {MESSAGE_ID}: the message’s ID, without the part number.
  • {ATTACHMENT_COUNT}: how many attachments the email has.

Dates

  • {DATE}, {DATE_LOCAL}, {DATE_UTC}: the email’s date as the email has it, in this computer’s time, or in UTC.
  • {PROCESSED_DATE[...]}, {PROCESSED_DATE_LOCAL[...]}, {PROCESSED_DATE_UTC[...]}: when the email was processed.

The file

  • {FILENAME}, {EXT}, {FILENAMEEXT}: the file’s name, its extension, and both.
  • {ID}: the message’s ID with the part number. {IDS} is the same, but filled even when {ID} is already in the name (then {ID} is empty).
  • {PART_NUM}: the part number of the attachment or the body.

The account and folder

  • {ACCOUNT_EMAIL}: the account it was downloaded from.
  • {MAILBOX_FOLDER}: the mailbox folder’s full path. {MAILBOX_SUB_FOLDER}: the folder’s own name, without its path.
  • {ACCOUNT_FOLDER}, {ACCOUNT_MAILBOX}: the folder’s path in the account, and the mailbox (a shared mailbox or group for Exchange).

Only in steps

  • {SAVE_PATH}, {SAVE_FILE}: the folder the file was saved in, and its full path and name.
  • {OFILENAME}, {OEXT}, {OFILENAMEEXT}: the attachment’s name as it was sent.
  • {CLOUD_URL}, {CLOUD_PATH}, {CLOUD_FILENAME}: for the steps under Upload to cloud: where the file went.
  • {EMAIL_BODY}, {EMAIL_BODY_HTML}, {EMAIL_BODY_SOURCE}: the email’s text or HTML, in boxes such as an email’s text, a web hook or an AI prompt.
  • {ERROR_MESSAGE}: the error, in the steps under If something fails.

Your own fields

Values a rule finds under Fields to find, or the Parser reads, become fields too, such as {INVOICE_NUMBER} or {ORDER_ID}. They show at the end of the field list. See extract data from emails and attachments.

Customizing a field’s output

Most fields are simply filled in. A few take a setting in square brackets.

Date formats: DATE, DATE_LOCAL, DATE_UTC and PROCESSED_DATE

Put a format in square brackets. For example {DATE[yyyy-MM-dd]} gives 2026-04-23: the date only, without hours, minutes and seconds. {DATE_LOCAL[yyyy-MM]} gives the year and month in this computer’s time. The formats are .NET’s custom date and time formats.

For a folder for each year with a folder for each month inside, put two date fields with a \ between them: {DATE_LOCAL[yyyy]}\{DATE_LOCAL[MM]} gives 2026\04. A \ inside the square brackets doesn’t make folders.

{DATE} without a format is the date as the email has it, with commas, colons and the time zone. In names, prefer a format.

EMAIL_HEADER[…]

Put the header’s name in the square brackets: {EMAIL_HEADER[message-id]}, or a header your supplier adds, such as {EMAIL_HEADER[X-Invoice-Number]}.

ATTACHMENT_COUNT[‘.pdf’ OR ‘.xml’]

Counts only the attachments whose names match, such as {ATTACHMENT_COUNT['.pdf' OR '.xml']}. Add the extensions or names you need. To pick emails by the number of attachments, use a condition instead: More attachments than or Fewer attachments than, with Counting only files named:. Conditions don’t fill in fields: they match the text as you type it.

What a name can’t hold

In folder and file names, a field’s value is cleaned up to make a valid name: \ and : become _, / becomes -, and " ? * | # are left out. Only a \ you type makes folders, and so do the folder fields: {SAVE_PATH}, {SAVE_FILE}, {MAILBOX_FOLDER}, {ACCOUNT_FOLDER} and {ACCOUNT_MAILBOX}.

Everywhere else (a database, a CSV file, an email, a web hook or an AI prompt) fields are filled in exactly as the email has them.

Examples

Example 1: a daily log of all files saved

Want a CSV file each day that lists the files saved and the emails they came from? Add a Save metadata step under Then (PRO Rules Client and up):

  • File: \\fileserver\Finance\Logs\{PROCESSED_DATE_LOCAL[yyyy-MM-dd]}.csv. The date has the day only, so every file saved that day goes into the same CSV.
  • Columns: for example {FILENAMEEXT},{EMAIL_FROM},{SUBJECT},{DATE[yyyy-MM-dd]}.
  • Tick Add to the file when it is there (otherwise replace it).

The next day starts a new file. Put the same step in each rule whose files you want in the log.

A Save metadata step in the Rule Editor with a File box, Columns built from fields, and Add to the file when it is there ticked
The Save metadata step: a file name and columns built from fields. Put a date in the file name to start a new log each day.

Example 2: a folder for each month, files named by sender

  • Save folder: \\fileserver\Finance\Invoices\{DATE_LOCAL[yyyy]}\{DATE_LOCAL[MM]}
  • File name: {EMAIL_FROM}_{FILENAME}_{ID}{EXT}

An invoice from ap@acme.example received in April 2026 is saved in \\fileserver\Finance\Invoices\2026\04, with the sender’s address at the start of its name.

Example 3: merge an email’s PDFs into one

The Merge PDFs step (PRO Rules Server) joins an email’s saved PDF files into one, with a File name built from fields, such as {SAVE_PATH}\{DATE[yyyy-MM-dd]}_{SUBJECT}_{ID}.pdf: one PDF for each email, in the folder its files were saved in. Start the name with {SAVE_PATH}\, so the PDF goes there. Emails of the same download that get the same name are joined into one file. A merged file from an earlier download is replaced, not added to, so processing the same emails again gives the same PDF.

The Rule Editor with a Merge PDFs step that joins the email's saved PDF files into one, named from the date, the subject and the ID
A Merge PDFs step, with a file name built from fields.

Related

Questions or suggestions about this post? Contact us.