Skip to main content

Email (IMAP / SMTP)

The Email (IMAP / SMTP) connector lets an Unstract Flow workflow use any mail provider that offers IMAP and SMTP. It reads threads over IMAP, sends mail over SMTP, and sets IMAP flags. Mention it as @email_generic. Each run can take the next thread as a pipeline item.

Connect​

The credential holds the server details and the login.

FieldExample
IMAP Hostimap.example.com
IMAP Port993
IMAP SSLOn for port 993
SMTP Hostsmtp.example.com
SMTP Port465
SMTP SSLOn for port 465
Usernameyou@example.com
PasswordThe mailbox password or an app password

Allow insecure TLS (unsafe) accepts a server certificate that can't be verified, and sends the password unencrypted when the server offers no STARTTLS. Leave it off unless your mail server uses a self-signed certificate.

SettingDefaultWhat it does
IMAP FolderINBOXThe folder the workflow reads. A thread found in another folder, by a step that names one, is read from the folder it was found in. Put a folder name that contains a space in double quotes, such as "Invoices 2026".
IMAP Search FilterEmptyAn IMAP search that limits which messages bring a thread into the pipeline; once a thread is in, get_thread reads all of its messages in the folder. For example, SINCE 6-Oct-2026 FROM "billing@example.com". Avoid UNSEEN if people read this mailbox: a message someone opens before the next check can be missed. Left empty, the first check queues the threads behind the folder's 500 newest messages, old ones included.

What a step can do​

ActionWhat it does
claim_next_threadClaims the next thread: one queued again by a new message in the last 24 hours first, then the available thread that entered the pipeline first. A thread queued again more than 24 hours ago comes after all of them.
list_threadsLooks at the threads of the folder's newest messages, as many messages as the step asks for (one by default). It returns those that aren't done, Failed or in use, and adds new ones to the pipeline.
get_threadReads a thread's messages and saves its attachments to the run's files.
send_messageSends a message, or replies within a thread. It can attach up to 10 files from the run, 25 MB in total, such as a PDF an earlier step made.
set_flagAdds or removes IMAP flags, such as \Seen or \Flagged, on every message in a thread.
refresh_pipelineLooks for new threads, and for new messages on threads already processed.
mark_thread_processedMarks a claimed thread Success or Failed when the run has finished with it.

Take the next thread from @email_generic. Build the summary PDF with @web_render and send it to the sender as an attachment. Then flag the thread \Seen.

When a run has finished with a thread, the thread is marked Success or Failed. A thread marked Success is queued again when a new message for it is among the 500 newest that match the IMAP Search Filter, unless it was marked done without being read and the message arrives before a check has seen the thread again. A thread marked Failed stays Failed: no run claims it again, and a new message on it doesn't queue it. When reading a thread fails because the mail server drops the connection or refuses the sign-in, the thread isn't marked Failed: the run gives it back, and a retry or the next run reads it. Each time, the thread waits 5 minutes before claim_next_thread offers it again, so the other threads go first. When every thread left is waiting, the claim takes nothing and its message says how many wait; a run after the wait picks them up. A retry that fails during those 5 minutes isn't counted. The third counted failure in a row marks it Failed with the error. The thread is marked Failed at once in two cases: the server refuses the read with one of the codes NONEXISTENT, NOPERM, CANNOT, CORRUPTION or AUTHORIZATIONFAILED, or the server refuses to open the folder and its folder list shows the folder isn't there or can't be opened. A refusal that says to try later (UNAVAILABLE, INUSE, SERVERBUG or LIMIT) never marks it Failed at once. Any other refusal from the server counts as a failed read, and the thread is given back. To process a Failed thread again, select Reset Status on it.

Limitations
  • If a run stops after claiming a thread, the thread stays Claimed, or Staged once the run has read it. To process it again, someone with the Owner, Admin or Member role selects Release claims in the run's details, or Reset Status on the thread. Release claims returns a Staged thread only with Also release items this run already read or finished ticked, since the run may already have replied to it. Once the claim is 8 hours old and its run has ended, a Claimed thread is marked Failed, and so is a Staged one when its run ended Failed or Cancelled; the check runs every 5 minutes. After a run that ended Succeeded or Partial, a Staged thread stays Staged until someone releases or resets it.
  • A message from the mailbox's own address never queues a processed thread again, such as a reply that copies the mailbox and lands back in the folder. Otherwise the workflow's own reply would queue the thread on every check.
  • A workflow prepared before mark_thread_processed existed doesn't call it, so its threads stay Staged and a new message doesn't queue them again. Prepare the workflow again. To process one thread again by hand, open its pipeline tab in the editor, under Email, and select Reset Status on it.
  • Each check for new threads reads the 500 newest messages that match the IMAP Search Filter.