PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

Email package guide

Read, move, save and send email from an automation.

Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.

Jump to actions

Packages

Prerequisites

What you need

Keep SSL/TLS on. To turn it off, the server must be on your private network and you must set Allow insecure transport. Only SMTP without sign-in can run without TLS and without that option.

Connect settings

Connect opens a named IMAP session for the current Run. Use these values in the examples:

Name in editorValue
Session namemail
Connect toEMAIL_SERVER
Hostimap.example.com
Port993
ProtocolIMAP
Use secure connection(SSL/TLS)true
UsernameA Credential whose username is the test account.
PasswordA Credential whose password is the account password. It can be the same Credential as Username.

Use Session name=mail in the later mailbox actions, then Disconnect.

Send settings

Forward, Reply, Reply All and Send open their own SMTP connection. They need these fields even after Connect. Use these values in the examples:

Name in editorValue
Send email viaEMAIL_SERVER
Email server hostsmtp.example.com
Email server port587
Use secure connection (SSL/TLS)true
From addressA sender test mailbox that the account may send from.
My server requires authenticationtrue if the server needs sign-in. Then bind Username and Password to the test account Credentials.

Test mailbox

Examples use session mail, message 42 and the Send settings above.

IMAP actions share the mail session; Send uses a separate SMTP connection.
Mailbox actions share one IMAP session during the Run. Send opens a separate SMTP connection with its own settings. View full size

Shared fields

A field is optional unless its table says required. These tables hold the fields that many actions use. An action that uses them says so under its Inputs.

Message selection

Field IDName in editorType; defaultUse
folderFolderStringdefault INBOXThe mailbox folder that holds the message. Blank means INBOX⁠. Use / between folder levels.
messageIdMessage id (IMAP UID)Stringdefault emptyThe message number (IMAP UID) as text, for example 42⁠. Blank uses the newest message in the folder; an empty folder then fails. Zero, a negative value or text that is not a whole number fails. The server can reject a valid number that does not exist, or make no change.

Filters

A message must match all the filters you fill. A blank filter is not used.

Field IDName in editorType; defaultUse
fromFrom specific sendersStringdefault emptySender text, with entries separated by semicolons or commas. A message matches if its From contains any entry.
sinceWhen received date is on or afterDatetimedefault unsetFirst received date, included, for example 2026-10-01T00:00:00Z⁠. Only the calendar date (UTC) is compared, not the time.
beforeWhen received date is beforeDatetimedefault unsetReceived date to stop before, not included, for example 2026-11-01T00:00:00Z⁠. Use a date later than the one in since⁠.

Sign-in

Field IDName in editorType; defaultUse
allowInsecureTransportAllow insecure transport to a private serverBooleandefault falsetrue allows IMAP without TLS, or SMTP sign-in without TLS, only to a server whose addresses are private or local. It does not turn off certificate checks.
emailServerAuthTypeAuthentication modeMailAuthTypedefault BasicBasic⁠: user name and password. Any other choice: user name and an OAuth token you already have. The action does not sign in for you. Choices: Basic⁠, authCodeGrant⁠, clientCredentials⁠, EMAIL_SERVER_CR_AUTH⁠, SEND_SMTP_CR_AUTH⁠, OAuth2⁠, Interactive⁠.
usernameUsernameCredentialdefault emptyA Credential variable. Its username part is the IMAP or SMTP login, also for OAuth. Its password part is not used here.
securedPasswordPasswordCredentialdefault emptyA Credential variable whose password part is the account password for Basic⁠. Its username part is not used.

Message fields

A successful send means the mail server accepted the message. It does not prove delivery.

Field IDName in editorType; defaultUse
ccccStringdefault emptyMore visible recipients, separated by semicolons or commas. Invalid entries are skipped, except in Send with Raise error if the email ids are invalid set to true⁠.
bccbccStringdefault emptyHidden recipients, separated by semicolons or commas. Invalid entries follow the cc rule.
replyTOReply ToStringdefault emptyAddresses that get the replies to the new message, separated by semicolons or commas. It does not change which message is answered.
fileListAttachmentListdefault emptyA List variable of local file paths, such as $attachments$⁠. A relative path starts in the Run folder. A typed list, or text with paths separated by commas or new lines, also works; use a List for a path that has a comma.
ensureAttachmentsExistRaise error if the attachments are missingBooleandefault falsetrue fails before sending when an attachment is missing. With false⁠, missing files are left out.
importanceImportanceMailImportancedefault NormalThe importance mark of the message. Choices: High⁠, Normal⁠, Low⁠.
bodyFormatEmail bodyBodyFormatdefault PLAINTEXTPLAINTEXT sends Message as text. HTML sends Message as HTML code. HTMLEDITOR is not supported and fails. Choices: PLAINTEXT⁠, HTMLEDITOR⁠, HTML⁠.
messageMessageStringdefault emptyThe body, for example Invoice sample attached⁠, or HTML such as <p>Invoice sample</p> with Email body HTML⁠. Replies add the quoted original below this text.
htmlEditorMessageHTML design messageDictionarydefault emptyNot supported. Leave empty and use Message with PLAINTEXT or HTML⁠.
goGreenInclude Go Green message at the end of the emailBooleandefault falsetrue adds Please consider the environment before printing this email. to the body, in English, for text and HTML.
encodingEncoding for emailMailEncodingdefault UTF_8The body encoding. If an older code page is not available, the action logs it and uses UTF-8. A forwarded original message is not re-encoded. Choices: UTF_8⁠, UTF_16⁠, gb2312⁠, Shift_JIS⁠.
fromAddressFrom addressStringdefault emptyA sender test mailbox that the account may send from. Blank uses the Username's username, which must then be a valid email address. An invalid sender always fails.

Send settings

Field IDName in editorType; defaultUse
serverTypeSend email viaSendViadefault EMAIL_SERVERChoose EMAIL_SERVER for SMTP. OUTLOOK and EWS always fail. Choices: EMAIL_SERVER⁠, OUTLOOK⁠, EWS
emailServerHostEmail server hostStringdefault emptyThe SMTP host name without a scheme, for example smtp.example.com⁠. It is separate from the IMAP host.
emailServerPortEmail server portNumberdefault 25The SMTP port: usually 587 for STARTTLS or 465 for TLS from the start, as the server needs.
useSecureConnectionUse secure connection (SSL/TLS)Booleandefault falsetrue requires TLS: port 465 starts TLS at once, other ports use STARTTLS. With sign-in, false needs Allow insecure transport and a private server.
requiresAuthenticationMy server requires authenticationBooleandefault falsetrue when SMTP needs sign-in. Then give Username and Password for Basic⁠, or the OAuth token for any other choice. false skips sign-in.
smtpOAuthConnectionConnection (bearer token)Stringdefault emptyThe SMTP OAuth token you already have, when sign-in is on and the mode is not Basic⁠. A connection name does not work here.
smtpConnectionTimeOutConnection timeout duration (seconds)Numberdefault 60The SMTP timeout in seconds, for example 60⁠. Values below 1 use 1 second.

Actions

This package has no conditions.

Change status (emailChangeStatus)

Mark one message as read or unread.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
changeStatusToChange status toStatusTodefault ReadRead marks the message read; Unread marks it unread. Choices: Read⁠, Unread⁠.

Also uses the message selection.

Outputs

No outputs.

Example

Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42 and Change status to=Read.

Expected result

The message is read. Choose Unread to undo it. A missing folder or a server that denies the change fails.

Back to actions

Check if folder exists (emailCheckFolder)

Check whether a mailbox folder exists.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
folderNameFolder nameStringdefault emptyrequiredThe mailbox folder to check, for example Archive⁠. For the inbox, type INBOX⁠.

Outputs

OutputTypeMeaning
existsBooleanBind to a Boolean variable such as folderExists⁠. true if the folder exists, false if not.

Example

After Connect, set Session name=mail and Folder name=Archive. Bind Folder exists to folderExists.

Expected result

folderExists is true. A missing folder gives false. A missing session or another server error fails the step.

Back to actions

Connect (emailConnect)

Open a signed-in IMAP session for the later mailbox actions. Only EMAIL_SERVER with IMAP works.

Inputs

Field IDName in editorType; defaultUse
sessionSession nameStringdefault emptyA name for this session, for example mail⁠. Later mailbox actions use it.
serverTypeConnect toServerKinddefault EMAIL_SERVERChoose EMAIL_SERVER for IMAP. OUTLOOK and EWS always fail. Choices: OUTLOOK⁠, EMAIL_SERVER⁠, EWS
useSecureUse secure connection(SSL/TLS)Booleandefault trueKeep true⁠: port 993 starts TLS at once, other ports use STARTTLS. false needs a private server and Allow insecure transport.
serverHostHostStringdefault emptyThe IMAP host name, for example imap.example.com⁠, without a scheme or folder. Needed to run.
portPortNumberdefault 993The IMAP port, usually 993 for TLS or 143 for STARTTLS.
protocolProtocolProtocoldefault IMAPChoose IMAP⁠. POP3 fails because the mailbox actions need folders, read marks and moves. Choices: IMAP⁠, POP3⁠.
emailServerOAuthConnectionConnection (bearer token)Stringdefault emptyThe IMAP OAuth token you already have, when Authentication mode is not Basic⁠. Leave empty for Basic⁠. A connection name does not work here.
emailServerConnectionTimeOutConnection timeout duration (seconds)Numberdefault 60The IMAP timeout in seconds, for example 60⁠. Values below 1 use 1 second.
selectOutlook mailboxMailboxSelectdefault LISTshown when serverType=OUTLOOKOutlook only, which does not work. LIST picks a mailbox; VARIABLE uses a mailbox variable. Choices: LIST⁠, VARIABLE⁠.
mailboxMailboxStringdefault emptyshown when serverType=OUTLOOKOutlook only, which does not work. Leave empty.
emailIDVarMailbox variableStringdefault emptyshown when serverType=OUTLOOKOutlook only, which does not work. It does not pick an IMAP account.
exchangeServiceExchange versionExchangeServicedefault Exchange2013shown when serverType=EWSEWS only, which does not work with any version. Choices: Exchange2013⁠, Exchange2010_SP2⁠, Exchange2010_SP1⁠, Exchange2010⁠, Exchange2007_SP1⁠.
ewsCloudAzure CloudEwsClouddefault comshown when serverType=EWSEWS only, which does not work. com is the commercial cloud, us the US cloud. Choices: com⁠, us⁠.
domainDomain nameStringdefault emptyshown when serverType=EWSEWS only, which does not work. It is not an IMAP host name.
authTypeAuthentication modeMailAuthTypedefault Basicshown when serverType=EWSEWS only, which fails with every choice. Use the other Authentication mode with EMAIL_SERVER⁠. Choices: Basic⁠, authCodeGrant⁠, clientCredentials⁠, EMAIL_SERVER_CR_AUTH⁠, SEND_SMTP_CR_AUTH⁠, OAuth2⁠, Interactive⁠.
ewsUsernameUsernameCredentialdefault emptyshown when serverType=EWSEWS only, which does not work. IMAP does not read it.
ewsSecuredPasswordPasswordCredentialdefault emptyshown when serverType=EWSEWS only, which does not work. IMAP does not read it.
connectionTimeOutConnection timeout duration (seconds)Numberdefault 60shown when serverType=EWSEWS only, which does not work. For IMAP, use the other Connection timeout duration (seconds).

Also uses the sign-in fields.

Outputs

OutputTypeMeaning
sessionNameStringThe Session name input, for example mail⁠. Bind to a String variable if needed.

Example

Use the Connect settings from Prerequisites. Bind both Username and Password to the test account Credential, and bind the Session name output to mailSession.

Expected result

mailSession is mail and the session is signed in. A bad password, token, TLS setup or host fails and creates no session. POP3, OUTLOOK and EWS fail before they connect.

Back to actions

Delete all (emailDeleteAll)

Delete for good every message that matches all the filters. See Delete for what else is removed.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
folderFilterFrom specific foldersStringdefault emptyFolder names separated by semicolons or commas, for example DeleteSamples;Archive⁠. Blank means INBOX only, not all folders.
readStatusType of email to deleteReadStatusdefault ALLALL (every message), READ or UNREAD⁠.
subjectFilterWhen subject containsStringdefault emptyText to find in the subject, for example Invoice sample⁠.

Also uses the filters.

Outputs

No outputs.

Example

Set Session name=mail, From specific folders=DeleteSamples, Type of email to delete=ALL and When subject contains=Invoice sample. Leave the sender and dates unset.

Expected result

The matching test messages are deleted for good. No match makes no change. A blank folder filter means INBOX, so type DeleteSamples.

Back to actions

Delete (emailDeleteMessage)

Delete one message for good (not to Trash). Other messages already marked for deletion in that folder are also removed.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.

Also uses the message selection.

Outputs

No outputs.

Example

Put a test message in DeleteSamples and get its UID. For UID 7, set Session name=mail, Folder=DeleteSamples and Message id (IMAP UID)=7. After a move, do not use the old INBOX UID.

Expected result

The message is removed from the mailbox, not moved to Trash. A bad UID, or a server that does not allow the delete, fails.

Back to actions

Disconnect (emailDisconnect)

Close an open IMAP session after the last mailbox action.

Inputs

Field IDName in editorType; defaultUse
sessionSession nameStringdefault emptyThe name given to Connect, for example mail⁠.

Outputs

No outputs.

Example

After the mailbox examples, set Session name=mail.

Expected result

The session closes. Later mailbox actions with mail fail until Connect runs again. Disconnect fails if mail is not open.

Back to actions

Forward (emailForward)

Forward a message as an attached .eml file, with a new body.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
toAddressTo addressStringdefault emptyrequiredA recipient test mailbox, or a list separated by semicolons or commas. An invalid address fails.

Also uses the message selection, sign-in fields, message fields and send settings.

Outputs

No outputs.

Example

Set Session name=mail, Folder=INBOX and Message id (IMAP UID)=42. Type a recipient test mailbox in To address, and set Message=Please review this sample.

Expected result

The mail server accepts a message with subject Fwd: Invoice sample (no second Fwd: if the subject has one). The original message and its attachments are inside an attached .eml file. An invalid To address always fails. For a missing extra attachment, see Raise error if the attachments are missing.

Back to actions

Move (emailMove)

Move one message to an existing mailbox folder. It can get a new UID there.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
folderPathDestination folder path in mailboxStringdefault emptyrequiredAn existing mailbox folder, for example Archive⁠. Not a local disk path.

Also uses the message selection.

Outputs

No outputs.

Example

Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42 and Destination folder path in mailbox=Archive.

Expected result

The message is in Archive and no longer in INBOX. Its new UID is not returned. A missing destination, or a server that cannot move, fails.

Back to actions

Move all (emailMoveAll)

Move every message in one folder that matches the filters to an existing folder.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
destinationfolderPathDestination folder path in mailboxStringdefault emptyrequiredAn existing mailbox folder, for example Archive⁠. Not a local disk path.
readStatusType of emails to moveReadStatusdefault ALLALL (every message), READ or UNREAD⁠.
sourceFolderFrom a specific folderStringdefault INBOXThe source mailbox folder, for example INBOX⁠. Blank also means INBOX⁠.
subjectWhen subject containsStringdefault emptyText to find in the subject, for example Invoice⁠.

Also uses the filters.

Outputs

No outputs.

Example

Set Session name=mail, From a specific folder=INBOX, Destination folder path in mailbox=Archive, Type of emails to move=UNREAD and When subject contains=Invoice. Leave the other filters unset.

Expected result

Unread invoice messages move to Archive. Read or other messages stay. No match moves nothing. A missing destination fails when there is a message to move.

Back to actions

Reply (emailReply)

Reply to a message. The reply goes to the original Reply-To, else From, else Sender, and stays in the same conversation.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.

Also uses the message selection, sign-in fields, message fields and send settings.

Outputs

No outputs.

Example

Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42, Message=Received, thank you and Email body=PLAINTEXT.

Expected result

The mail server accepts a reply with subject Re: Invoice sample (no second Re: if the subject has one) and the quoted original below the answer. The original attachments are not added. A missing message or recipient fails.

Back to actions

Reply All (emailReplyAll)

Reply to the sender and to the original To and Cc recipients. An address can get the reply twice, and you can be on the list.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
excludeSenderExclude the sender of emailBooleandefault falsetrue does not add the original Reply-To, From or Sender. The original To and Cc stay, so the sender still gets a copy if listed there.
subjectSubjectStringdefault emptyA new subject, for example Sample response⁠. Blank keeps the original subject with Re: added (no second Re:).
ccAdditional CcStringdefault emptyMore visible recipients, added to the original Cc. Separate them with semicolons or commas. Invalid entries are skipped.

Also uses the message selection, sign-in fields, message fields and send settings.

Outputs

No outputs.

Example

Use a message sent only to test mailboxes. Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42, Exclude the sender of email=false, Subject=Sample response and Message=Received.

Expected result

The mail server accepts Sample response for the original reply address, the original To and Cc, and any added Cc and Bcc. With Exclude the sender of email set to true, only the original reply address is left out. A mail server error fails the step.

Back to actions

Save all attachments (emailSaveAllAttachments)

Save the attachments of every message with the chosen read status in one folder. There are no subject or date filters.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
readStatusStatus of emailReadStatusdefault ALLALL (every message), READ or UNREAD⁠.
enableStatusNoUpdateRetain email statusBooleandefault falsetrue notes which messages are unread and marks them unread again after saving. With false⁠, their old unread status is not restored.
folderFrom a specific folderStringdefault INBOXThe source mailbox folder. Blank means INBOX⁠.
folderPathSave attachments to folderStringdefault emptyrequiredA local folder, for example samples/attachments⁠. A relative path starts in the Run folder. The action creates it if needed.
checkOverrwriteOverwrite file(s)Booleandefault falsetrue replaces an existing file. With false⁠, an existing name fails the step; it is not skipped.

Outputs

OutputTypeMeaning
filesListThe path of every saved attachment, or an empty List if none was saved. Bind to a List variable.

Example

Use a test INBOX that holds only the sample message. Set Session name=mail, From a specific folder=INBOX, Status of email=UNREAD, Retain email status=true, Save attachments to folder=samples/bulk and Overwrite file(s)=false. Bind Saved files to bulkAttachments.

Expected result

The List holds the saved attachment paths. Messages that were unread are unread again. No matching attachment gives an empty List. Two attachments with the same name can fail after earlier files were already saved.

Back to actions

Save attachments (emailSaveAttachment)

Save all attachments of one message to a local folder. Characters that are not allowed in file names are replaced.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
folderPathSave attachments to folderStringdefault emptyrequiredA local folder, for example samples/attachments⁠. A relative path starts in the Run folder. The action creates it if needed.
checkOverrwriteOverwrite file(s)Booleandefault falsetrue replaces an existing file. With false⁠, an existing name fails the step; it is not skipped.

Also uses the message selection.

Outputs

OutputTypeMeaning
filesListThe path of every saved attachment, or an empty List if none was saved. Bind to a List variable.

Example

Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42, Save attachments to folder=samples/attachments and Overwrite file(s)=false. Bind Saved files to savedAttachments.

Expected result

The action creates samples/attachments/invoice.txt, and the List holds its full path. A message without attachments gives an empty List. An existing name fails when Overwrite file(s) is false.

Back to actions

Save email (emailSaveEmail)

Save one full message as an .eml file.

Inputs

Field IDName in editorType; defaultUse
sessionNameSession nameStringdefault emptyThe name given to Connect, for example mail⁠.
folderPathSave emails to folderStringdefault emptyrequiredA local folder, for example samples/saved⁠. A relative path starts in the Run folder. The action creates it if needed.
fileNameFilenameStringdefault emptyA file name without a path, for example invoice⁠. Blank uses the subject. Characters not allowed in file names become underscores, the name is cut at 120 characters, and .eml is added if missing.
checkOverrwriteOverwrite file(s)Booleandefault falsetrue replaces an existing file. With false⁠, an existing name fails the step; it is not skipped.

Also uses the message selection.

Outputs

OutputTypeMeaning
fileStringThe full local path of the saved .eml file. Bind to a String or Any variable.

Example

Set Session name=mail, Folder=INBOX, Message id (IMAP UID)=42, Save emails to folder=samples/saved, Filename=invoice and Overwrite file(s)=false. Bind Saved file to savedMessage.

Expected result

samples/saved/invoice.eml holds the full message, and savedMessage holds its path. Saving again fails while the file exists, unless Overwrite file(s) is true.

Back to actions

Send (emailSend)

Write and send a new message. This sends real mail to the recipients.

Inputs

Field IDName in editorType; defaultUse
toAddressTo addressStringdefault emptyrequiredA recipient test mailbox, or a list separated by semicolons or commas. Invalid entries follow Raise error if the email ids are invalid. At least one To, Cc or Bcc recipient must stay.
subjectSubjectStringdefault emptyThe subject, for example Invoice sample⁠. Blank sends an empty subject.
invalidAddressRaise error if the email ids are invalidBooleandefault falsetrue fails on an invalid To, Cc, Bcc or Reply To entry. With false⁠, invalid entries are skipped; a message with no recipient left still fails.

Also uses the sign-in fields, message fields and send settings.

Outputs

No outputs.

Example

Type a recipient test mailbox in To address. Set Subject=Invoice sample, Email body=PLAINTEXT, Message=Invoice sample attached, Attachment=$attachments$ and Raise error if the attachments are missing=true.

Expected result

The mail server accepts a message with subject Invoice sample, the body text and invoice.txt. For invalid recipients, see Raise error if the email ids are invalid. No recipient left, or a missing attachment with Raise error if the attachments are missing set to true, fails before sending.

Back to actions