Skip to main content
Version: 1.28 (Current)

Email Sync

Audience: Low-code Engineers, System/Security Administrators

Skill Prerequisites: Actions, Tokens, Connectors, Automation

The Email Sync add-on lets your applications process incoming email. It adds IMAP and POP3 connector types for mailboxes, and IMAP and POP Mail triggers for Automation jobs. The job runs its actions once for each new email, with the sender, subject, body and attachments in tokens. The add-on also adds actions to manage and test the mailbox connectors.

note

This add-on is the DnnSharp.EmailSync package. It's installed separately and needs the EMSYNC feature in your license. If it isn't licensed, the actions fail with a "not licensed" error and the IMAP trigger doesn't start listening. If you don't see the IMAP and POP3 connector types, or the Mail triggers in Automation, the add-on isn't installed.

What it adds​

ItemWhat it doesUse it to
IMAP triggerListens to one or more mailboxes and runs the job for each new email.Process incoming email, such as orders, support requests or replies. This is the recommended trigger.
POP Mail (Obsolete) triggerChecks one mailbox at a set interval and runs the job for each new email.Keep existing jobs running. For new jobs, use IMAP.
IMAP and POP3 connector typesStore a mailbox's server, SSL setting, username, password and custom data.Create mailbox connectors on the Connectors page.
Add Imap ConnectorAdds an IMAP connector to a group.Let users connect a mailbox from a form. In 1.28 it fails in apps, see the action page.
Update Imap ConnectorReplaces all the details of an IMAP connector.Save a new mailbox password. In 1.28 it fails in apps, use Update Connector.
Test IMAP ConnectorSigns in to the mail server with one IMAP connector, or with every connector in a group.Check mailbox details before the IMAP trigger uses them.
Add POP3 ConnectorAdds a POP3 connector to a group.Add a mailbox for an existing POP Mail job.
Update POP3 ConnectorReplaces all the details of a POP3 connector.Change a mailbox used by a POP Mail job.

Mailbox connectors​

Both connector types have the same settings:

SettingDescription
Hostname (IMAP) or POP3 Server (POP3)The mail server, for example imap.example.com. To use another port, add it after a colon, for example imap.example.com:1993.
Use SSLWhether to connect with SSL/TLS. Without a port in the hostname, IMAP uses port 993 with SSL and 143 without it, and POP3 uses 995 and 110.
UsernameThe username or email address used to sign in.
PasswordThe password used to sign in. It's stored encrypted.
Custom DataExtra name/value pairs. The IMAP trigger turns each one into a [CredentialData:<Key>] token, for example to tell which customer a mailbox belongs to.

The triggers sign in with the username and password only. They don't use OAuth, so they can't connect to mail services that only allow OAuth sign-in. The IMAP trigger and Test IMAP Connector reject a connector with an empty Hostname, Use SSL, Username or Password.

IMAP trigger​

Add the IMAP trigger from the Mail group to an Automation job. When the job is enabled, the trigger connects to each mailbox and keeps the connection open. It uses IMAP IDLE when the server supports it, so new email is processed soon after it arrives. On the first connection, it also processes the existing email that matches the trigger's settings.

The trigger opens the folder read-only. It doesn't delete, move or mark email.

Settings​

SettingDescription
ConnectorThe IMAP connectors to listen to. Pick one or more connectors, or a group. The trigger opens one connection for each connector, so keep it to about 20.
Start DateOnly email dated after this date is processed. Changing it on an active trigger resets where the trigger continues from, which can cause duplicates or missed email.
Ignore errorsWhen checked, an email that fails while its tokens are created or its attachments are saved is skipped, and the trigger continues with the next one. Errors in the job's actions never stop the trigger.
Folder to watchInbox (default) or All. All needs a server that supports the IMAP special-use folders. Otherwise the trigger watches the Inbox.
Make this go through all existing mail at first runProcesses all email in the folder, ignoring Start Date. It's turned off again after the next run.
Trigger only for new e-mailsIgnores Start Date and only processes email that arrives after the trigger first connects to a mailbox. Use it when connectors are added to the group later, for example by users.
Compact body textRemoves empty lines and extra spaces from [Mail:BodyText].
Save AttachmentsSaves each email's attachments to a portal folder before the job runs.
Attachments save directoryThe folder for saved attachments. Supports tokens. When it's empty, the portal's Temp folder is used.
Handle duplicatesWhat to do when a file with the same name is already in the folder: Overwrite, Pattern Rename, Windows Rename or Date Rename.
Rename PatternThe text added to the end of the file name when Pattern Rename is selected. Supports tokens.
Filter E-mail by subject, recipient, sender, Cc, Bcc or bodyOnly process email whose field matches. Without Use Regex, the value must match the whole subject, the whole body or one whole address exactly. With Use Regex, the value is a regular expression that must match. Filters support tokens.
Filter E-mail by attachmentsHas attachments or Doesn't have attachments.
Custom Headers FiltersHeader names and values. Only email that has the header, with exactly that value, is processed.
Select additional mail headersHeader names and token names. When an email has the header, its value goes into a token with the name you give, for example X-Priority → MailPriority gives [MailPriority].

Tokens​

TokenDescription
[Mail:From] and [Mail:FromName]The sender's address and name.
[Mail:To] and [Mail:ToNames]The recipients' addresses and names, separated by commas.
[Mail:Cc] and [Mail:CcNames]The Cc addresses and names, separated by commas.
[Mail:Bcc] and [Mail:BccNames]The Bcc addresses and names, separated by commas.
[Mail:Subject]The subject.
[Mail:DateSent]The date the email was sent.
[Mail:Body]The HTML body if there is one, otherwise the text body.
[Mail:BodyText]The body as plain text. If the email only has an HTML body, it's converted to text.
[Mail:BodyHTML]The HTML body, if there is one.
[Mail:HasAttachments]True if the email has attachments.
[Mail:AttachmentsNameList]The attachment file names, separated by commas.
[Mail:AttachmentsListJson]The attachment file names as a JSON array.
[Mail:UploadedAttachmentsInfoJson]With Save Attachments, a JSON array with the FileId, FileName and RenamedFileName of each saved file.
[Mail:RenamedAttachmentsNameListJson]With Save Attachments, the saved file names as a JSON array.
[Mail:DisallowedAttachmentsJson]With Save Attachments, the attachments that weren't saved because their file extension isn't allowed in the host settings.
[CredentialData:Hostname], [CredentialData:Username] and [CredentialData:UseSSL]The settings of the connector the email came from. The password isn't available.
[CredentialData:<Key>]Each custom data value of the connector.

To work with the attachments list, use Create List from JSON or Parse JSON into Tokens.

Errors and reconnecting​

  • Errors are saved in the job's history.
  • If the connection drops, the trigger waits and reconnects, with a longer wait after each failure. When the wait passes 10 minutes, it stops and saves The job needs to be manually restarted after the error is fixed. Fix the problem, then restart the job.
  • When you change a connector, for example its password, the trigger reconnects with the new details. When you delete a connector, the trigger stops listening to it.

POP Mail trigger (obsolete)​

The POP Mail (Obsolete) trigger connects to one POP3 mailbox at the Check Interval you set, for example every minute. It processes the email received after its start date, then saves the date of the newest email as the new Start Date.

Its settings are like the IMAP trigger's, with these differences:

  • It takes a single connector, and has Check Interval instead of Folder to watch, Ignore errors and Trigger only for new e-mails.
  • Attachments save directory is required.
  • Make this go through all existing mail at first run isn't turned off after a run, so every check processes all email in the mailbox again. Turn it off after the first run.
  • Filters without Use Regex match when the field contains the value, instead of matching it exactly.
  • [Mail:To], [Mail:Cc] and [Mail:Bcc] contain names and addresses, such as Jane Doe <jane@example.com>. There are no ...Names or [CredentialData:...] tokens.

For new jobs, use the IMAP trigger.

For sending email, see Email and Email OAuth. For the generic connector actions, see Connectors.

Revised 10/02/2026