Workflow gửi email

Smart Hosts require a command line script to send email, as they do not have a built-in mail client. A gmail account must be created and associated with the host; this will be the account that emails will be sent from.

Configuring Email on a Smart Host

The following instructions are used to set up mail access using a gmail.com account. This script is specific to gmail.com and should not be used to setup email for other email services.

NOTE: The specific steps and menu selections described below are based on the Google®/gmail software/web UI active at the time of writing, and may be subject to change at any time with no notice to Savant. If the steps below do not align with the options presented, note that the general requirements remain the same, and steps should be reasonably modified based on the current options presented to the user at the time.

  1. On the SDE, launch Savant Application Manager (SAM).

  2. Select the appropriate da Vinci release for the host and click Activate.

  3. Open System Monitor from the right menu.

  4. In an open System Scanner window, select the Savant Smart Host.

  5. Click Terminal in the menu bar to open an ssh session with the selected host.

  6. When prompted, enter the password for the host.

  7. At the command prompt type: savantSetGmailAccount

  8. Follow the instructions that appear in the dialog box.

Gmail may block the login from the Smart Host initially. Send a test email via the Host, either by completing the workflow configuration and running the workflow, or by executing the relevant command and arguments to send a test email directly from a terminal command prompt on the Host. IF the test email has not been sent after several minutes, follow the steps below:

  1. Log into the Gmail.com account being used to send the email.

  2. Navigate to the Security Settings of the account.

  3. Approve the "unknown device" that has recently attempted to access the gmail account (this is the Smart Host).

  4. Also in the Security Settings, change "Allow Less Secure Apps"to ON.

NOTE: Two-Factor authentication is not supported for use within the Savant System.

Creating an Email Workflow on a Smart Host

  1. Open a configuration in Blueprint and Generate Services.

  2. In the open View Services window, select a room in the Services For drop-down list.

  3. Double-click the created workflow to open Automator.

  4. In the open Automator window, search for "Run".

  5. Drag the Run Shell Script action into the workflow.

  6. Enter the following into Run Shell Script action based on the Smart Host model being used.

SVR-SMRTD-00 | SVR-SMRTD-10 Smart Host echo "Your Message" | mail -s "Email Subject" recipient@email.com -- -f senderAccount@gmail.com -F "Name of Sender"

SHC-2000-xx Smart Host | SHC-S2 Smart Host echo "Your Message" | /usr/local/bin/rpm/savantMail -s "Email Subject" -r recipient@email.com -f senderAccount@gmail.com -F "Name of Sender"

Substitute Field Values:

Your Message

Example: “This is to inform that the Savant system for [Customer] has been restarted and is back in operation.” Replace [Customer] with the name of the customer.

Email Subject

Example: [Customer] System Has Restarted. Replace [Customer] with the name of the customer.

recipient@email.com

Email address of the recipient. See Sending SMS Text Messages to send a text in place of an email.

senderAccount

Account name that was setup on the host to send emails. Gmail accounts only.

Name of Sender

Name of as the sender in the email's From: section.

  1. Save the workflow.

  2. Re-generate services, save the Blueprint configuration, and upload to the Host.

IMPORTANT NOTES!

  • A backslash is required before any special character inside the body or subject of the email. The backslash will not show in the message sent. Example: echo "System has Restarted\!" | /usr/local/bin/rpm/savantMail -s "Email Subject" -r recipient@email.com -f senderAccount@gmail.com -F "Name of Sender"

  • In the event that the Host is unable to send a test email, log in to the Gmail account in use, and review the "Device Activity and Security Events" section of the Sign-In and Security settings page. The Savant Host may need to be allowed permission to access the account within this menu.