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.
- Email Inbound Connector license
- Separate mailbox, with IMAP protocol, enabled (e.g. Outlook)
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.
- Open the PowerShell as Administrator
- Configure the following cmdlet
Set-AsrEMailInboundConnector -Host Outlook.office365.com -Port 993 -UseSSL yes -MailboxAccount email@example.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.
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.
- Open the ScriptRunner Admin App
- Go to Automation
- Create a new Connector; Email Inbound Connector
- Enable the Connector
- Assign a Display name
- Enter the senders' email address (SR will only listen to emails from this address)
Use the following cmdlet to test the Email Inbound Connector
Test-AsrEmailInboundConnector -ClearPassword $password
- Send a mail via the email address stored in ScriptRunner (Sender@ScriptRunner.com) to the email address configured in PowerShell (Jeff.ScriptWalker@ScriptRunner.com)
- 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.
- 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.
- 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.
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
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