In CX-Supervisor 4.0 and later, sending emails can be achieved 2 ways.
Method 1: Sending on Alarm events (no code)
Each CX-Supervisor Alarm can be selected to automatically send an alert email automatically, when the alarm condition is raised and cleared. This method requires no script code to be written and therefore very simple:
- In the Developer, make sure you configure your SMTP server in the Project menu, Runtime Settings->Email Settings:
* Your SMTP server address (for example SMTP.gmail.com if using gmail smtp server)
* The User for your email account name
* The password for you email account. This is so the EmailText() script can log in to your email account to send the mail.
- When configuring your Alarms, tick the box to send an email and enter the destination email for this type of alarm:
Tip: For the target email address, a good idea is to create a generic email account or group specifically for notification, for example OPERATOR_USER or MANAGER_NOTIFY rather then specify a user account directly. Then as employees join or leave the group membership or email forwarding rules can be manged by your IT team, and therefore not require your CX-Supervisor project to be rebuilt each time.
Method 2: Sending from script code
For sending on any other condition you can write a small script as On Condition script, button script etc using the EmailText() script function:
bSuccess = EmailText(Recipient, Subject, BodyText, cc, bcc, Attachments)
Note there is also an EmailReport() script function, if you want to take a report template file, and generate and send a new report file in one action.
How To Send Emails From CX-Supervisor With Gmail