Skip to content

IMAP Move

Type: imap-move  ·  Package: SMTP / IMAP Email Activities v1.0.5

Moves an email from one IMAP folder to another. The way to organize the mailbox after processing: take what was handled to a “Processed” folder, archive, or classify by type.

Given the mailId (from IMAP Read), it moves the email from its source folder (folder, INBOX by default) to targetFolder.

  • The target folder must exist on the server: the activity does not create it. INBOX is accepted case-insensitively; others need the name and separator the server uses ("Processed", "INBOX/Processed" or "INBOX.Processed").
  • In the target folder the email gets a new UID: the previous .Id no longer works. Run the other actions (attachments, mark) before moving it.
ParameterTypeDefaultDescription
hoststring—IMAP server.
usernamestring—Username.
passwordcredential—Password or App Password. Use credential("name")["password"].
mailIdstring—Email UID (from email.Id). Must be numeric.
targetFolderstring—Target folder (e.g. "Processed", "Archive").
ParameterTypeDefaultDescription
portint993IMAP port.
folderstring"INBOX"Source folder (the same the email was read from).
securitystring"ssl"Encryption: auto, none, ssl or starttls.

This activity does not return a value.

MessageCause and fix
Invalid 'mailId'. It must be the numeric UID returned by imap-read.mailId is not a number. Pass email.Id from IMAP Read.
'mailId' is required. / 'targetFolder' is required.The parameter is missing or the expression returned null.
Folder not found errorfolder or targetFolder does not exist on the server. Create it from your mail client or fix the name.
Authentication or connection errorSame as in IMAP Read.
For Each items = emails itemVariable = email
└─ activities:
... process ...
IMAP Move host = "imap.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"]
mailId = email.Id targetFolder = "Processed"