PopImap task#
A PopImap task reads a mailbox and saves what it finds as files: the attachments of the messages, their text, or both. It is how files that partners send by mail get into the same processing as files they upload: the task fetches them, and the tasks behind it treat them like any other file.
It needs an Enterprise licence. For Microsoft 365 mailboxes there is also the MicrosoftMails task, which does not use IMAP.
The mailbox#
| Field | What it does | On a new task |
|---|---|---|
| Protocol | IMAPs, IMAP, POP3s, POP3. The two with an s are encrypted from the start. | IMAPs |
| Host, Port | the mail server | |
| StartTLS | for the plain kinds: switch to an encrypted connection after connecting | off |
| Mail Username, Mail Password | ||
| Mail Inbox | the folder to read | Inbox |
| Accept any SSL certificate | for a first test only | off |
| Test Mailbox Settings | connects and says whether it worked | |
| Route connection through DMZ when possible | the connection is made from a DMZ server |
Use IMAP where you can. POP3 knows one folder, cannot search on the server, and cannot mark a message as read.
Google and Microsoft no longer take a password for IMAP. The fields Google Client ID and Google Client Secret, and Get Refresh Token, sign the task in with OAuth instead; they appear when the host is one of theirs. A connection profile can hold that sign-in for several tasks.
Which messages#
| Field | What it does |
|---|---|
| Only process unread messages? | messages that are marked read are left alone |
| Subject Filter, From Filter, To Filter | patterns with *: only messages that match all that are filled in |
| Simple Query | one line that says the same and more: see below |
| Look inside attached messages | a message that was forwarded as an attachment is opened, and its attachments are taken too |
| Log only first 10 skipped messages | keeps the log short in a full mailbox |
Simple Query#
from:partner@example.com subject:invoice*
| Written | Means |
|---|---|
from: to: subject: attachment: and a value |
that part of the message matches the value. * stands for any text. |
| several, with spaces | all must hold |
from:anna@example.com|ben@example.com |
either value, with | and no spaces |
subject:!draft* |
not |
after:2026-04-30 before:2026-06-01 |
by date, as yyyy-MM-dd |
With IMAP the mail server does the searching and hands back only the messages that match. With POP3 the task has to fetch every message of the mailbox to look at it: slow, and heavy on memory, for a large mailbox.
What is saved#
| Field | What it does |
|---|---|
| Download files here | the folder to save into, as an address. Browse, Test. |
| Save attachments? | each attachment is saved as a file |
| Save body of email as file? | the text of the message is saved as a file |
| File Name | the name of the saved file. Empty: the attachment's own name. |
| Filename Filter | only attachments whose name matches: *.pdf |
| Minimum file size in bytes | leaves out the small pictures of signatures and logos |
Afterwards#
| Field | What it does |
|---|---|
| Mark messages as read after processing? | with Only process unread messages? this is how each message is handled once |
| After processing copy message to this mailbox | copies the message to another folder of the mailbox, such as Processed |
| Delete messages after processing? | removes the message from the mailbox |
What it hands on#
The items it was given, and behind them one item per saved file. Each has, besides the usual {name}, {path}, {url}:
| Variable | Is |
|---|---|
{from} |
the sender's address |
{from_prefix} |
the part of it before the @ |
{subject}, {body} |
of the message |
{mail_index} |
the number of the message in this run |
{mail_type} |
whether the file is an attachment or the body |
{header_message_id}, {header_date}, {header_reply_to}, {header_return_path} |
from the message's headers |
{header_received}, {header_source_ip}, {header_x_originating_ip}, {header_x_forwarded_for} |
the path the message took, and the sender's address where the headers say it |
file:///data/mail/{from_prefix}/{name} as the place to save sorts the attachments by sender.
Things to know#
- Mail is not trustworthy. A From address can be written by anybody, and an attachment can be anything. Save into a folder of the job's own, never into a folder a program runs things from, and check what arrives. The filters on sender and subject are a convenience, not a lock.
- Each message once. Use Only process unread with Mark as read, or move or delete the messages. Without one of them every run fetches everything again.
- A mailbox for the job. Give the job a mailbox of its own. A person's mailbox, read and marked by a job, confuses both.
- For every user's own mailbox, a UsersList can call this task once per user, with the user's mail settings as variables.