Email Inbound Connector

Starting Actions via email using a mailbox

The Email Inbound Connector is an alternative for systems that cannot communicate via REST. The communication between the source system and ScriptRunner takes place via email using a mailbox.

Requirements

  • Email Inbound Connector license
  • Separate mailbox, with IMAP protocol, enabled (e.g. Outlook)

Configuration

Mailbox

Create two folders under the inbox; SRIn & SRDone

Make sure the mailboxes are spelt correctly. Set the filter settings according to your requirements. Only emails that are copied or moved to the SRIn folder can be processed by ScriptRunner.

PowerShell

  1. Open the PowerShell as Administrator
  2. Configure the following cmdlet
Set-AsrEMailInboundConnector -Host Outlook.office365.com -Port 993 -UseSSL yes -MailboxAccount jeff.scriptwalker@scriptrunner.com  -ClearPassword $password -On -UseDoneFolder yes -UseInFolder yes -Restart

Make sure to set the parameters UseDoneFolder and UseInFolder to yes. Otherwise, the ScriptRunner service will process all emails in the mailbox.

Parameters

On: Switch on connector
Off: Switch off the connector
Host: FQDN or IP address of the IMAP host
Port: Port of the IMAP service
UseSSL: SSL for protected communication (yes/no)
mailboxAccount: User account name
password: user account password as secure string
ClearPassword: user account password in clear text
UseIdle: Use IMAP IDLE option (yes/no)
UseInFolder: Subfolder of the inbox; for incoming messages
UseDoneFolder: Subfolder of the inbox; for processed messages.
ActionFromSubject: Name of the ScriptRunner action in the subject line (yes/no)
SubjectPrefix: Process only messages with prefix string (e.g. #SR#)
Restart: Restart the ScriptRunner service

  • To apply the settings of the E-Mail Inbound Connector, the ScriptRunner service must be restarted.
  • Check your configuration with the Get-AsrEmailInboundConnector cmdlet.
ScriptRunner
  1. Open the ScriptRunner Admin App
  2. Go to Automation
  3. Create a new Connector; Email Inbound Connector
    1. Enable the Connector
    2. Assign a Display name
    3. Enter the senders' email address (SR will only listen to emails from this address)

Testing

PowerShell

Use the following cmdlet to test the Email Inbound Connector

Test-AsrEmailInboundConnector -ClearPassword $password

Email

  1. Send a mail via the email address stored in ScriptRunner (Sender@ScriptRunner.com) to the email address configured in PowerShell (Jeff.ScriptWalker@ScriptRunner.com)
  2. Select an action (e.g. Local: Add Two Values) and specify the required parameters:
    SRXAction = Local: Add Two Values
    ValueA = Script
    ValueB = Runner
    Note:
    The body of the e-mail must be in plain text format! HTML and RTF format and is not possible.
  3. The sent e-mail appears in the SRIn folder. ScriptRunner processes the sent action in the background. As soon as the action is done, the e-mail is automatically moved to the SRDone folder.
  4. If the action has been executed successfully, it can be viewed in the ScriptRunner Dashboard

The Email Inbound Connector logs the activities in the Windows Event Log under Application.

Alternative Configurations

With SubjectPrefix

Only emails with matching SubjectPrefix (example: #SR#) will be processed.

Set-AsrEMailInboundConnector -SubjectPrefix '#SR#' -Host Outlook.office365.com -Port 993 -UseSSL yes -MailboxAccount Jeff.ScriptWalker@ScriptRunner.com  -ClearPassword $password -On -UseDoneFolder yes -UseInFolder yes -Restart

With ActionFromSubject

The action name is included in the subject, the parameters are transmitted via the body.

Set-AsrEMailInboundConnector -ActionFromSubject yes -Host Outlook.office365.com -Port 993 -UseSSL yes -MailboxAccount Jeff.ScriptWalker@ScriptRunner.com  -ClearPassword $password -On -UseDoneFolder yes -UseInFolder yes -Restart