14 - 11 - 2018

Internet library

Block MailSender

The difficult question about how to send e-mail is easy resolved with block SendMail. When the input DoSend become to hight value, the SCADA software will try to send a e-mail.


Parameters related with Mail Server:

  • Server - host address of mail server. For example smtp.gmail.com
  • Port - port of the mail server. 25 is SMTP port without SSL connection, 465 is SMTP port with SSL connection;
  • UserName - User name of the mail account, for gmail is e-mail addres. For expample Този имейл адрес е защитен от спам ботове. Трябва да имате пусната JavaScript поддръжка, за да го видите.
  • PassWord - pass word of the mail account;
  • SenderEMail - e-mail of the mail account: Този имейл адрес е защитен от спам ботове. Трябва да имате пусната JavaScript поддръжка, за да го видите.
  • SSL - Yes/NO regarding using of SSL connection or not;

Parameters related with sending e-mail:

  • RecipientMail - e-mail address of the recipient;
  • RecipientName - name of the recipient
  • Subject - the subject of the e-mail;
  • Body – the text of the e-mail. It can be multiline;
  • AttachedFile - full path and name of the attached file. Optional;
  • MinPeriodToSendMail - a minimal period in seconds, which protect an e-mail account from sending too many e-mails. If several events OnSend occured in this period, ony the first will be send. When the period expired, a new e-mail can be send.

The block SendMail has a parameter Inputs, which allows many inputs from type Digital, Analog, Integer and String to be added to the block. These inputs allow some parameters to be changed from the running SCADA process. The paremeters are: RecipientMail, RecipientName, Subject, Body, AttachedFile. If in the text of the the mentioned parameters is included a name of the block's input in brakets <>, then the value of input will appears into the text of the parameter.

Let see how the demo diagram SendMail.nsm works. The value of parameter Body is:
The yard lamp is <Lamp>
Electrical boiler is currently <Boiler>
The season is <Season>

When the input DoSend becomes to hight value, the tags with <Block input name> will be changed with theirs values, so the result mail's body would be:

The yard lamp is On
Electrical boiler is currently Off
The season is Summer

Pelase note:

  • for Analog input type, after name of input, number of digits after dot can be added: <Temp;2> means two digits after dot in replaced string in mail's body;
  • for Digital input type is possibe to be added meaning of Hight or Low value of the input signal: <Lamp;Turn on;Turn off>

About how to format text you can read more at article SCADA Design -> Text Formatting strategy. The same strategy can be used to format text at block's parameters RecipientMail, RecipientName, Subject, Body.

At the demo diagram, the value of parameter RecipientMail is <mail>. This means when the input DoSend becomes to hight value, the value of parameter RecipientMail will be gotten from the value of input mail.

How to send e-mail via GMail account:
In order to allow AltoLab to send e-mail via GMail, some settings have to be set in GMail account:  go to GMail Settings -> Accounts and Import -> Other Google Account settings. Then in Signing section click to Access for less secure apps. This property has to be set to Turn on.

Google's SMTP server requires authentication, so here's how to set it up:

  • Server (i.e., outgoing mail): smtp.gmail.com
  • Username: Your full Gmail or Google Apps email address (Този имейл адрес е защитен от спам ботове. Трябва да имате пусната JavaScript поддръжка, за да го видите. )
  • Password: Your Gmail or Google Apps email password
  • SMTP port: 465
  • SMTP TLS/SSL required: yes

In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and: 6.Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.

Sending Limits:
Google limits the amount of mail a user can send, via its portable SMTP server. This limit restricts the number of messages sent per day to 99 emails; and the restriction is automatically removed within 24 hours after the limit was reached.

Block FTPUploader

The block is very powerful, it allows the complicated infromation from the diagram to be uploaded to FTP server and to build an OnLine WEB site very easy. The block is perfect for WEB publisher.



  • CommunicatePerMin - if the input DoSend is not connected, the block will upload to FTP server on every CommunicatePerMin minutes. If the DoSend input is connected, the upload will happend only when the input becomes to hight level.
  • FTP Parameters: FTP Server (IP or URL of the server), FTP Port, FTP User, FTP Password;
  • FTP Folder - the FTP User has to have access to this FTP folder;
  • For upload - this parameter opens an interface with three parts:

Available controls - this is a table, where the names of all the controls from the diagram are displayed. If the checkbox of the first column is checked, the image of the control will be converted to an image file and will be uploaded to FTP server. The name of the file is the same as the name of the control. If other name is needed of the file, double click over the table cell of the column "FTP File Name:" and change the name of the file. Default file extention is JPG, it can be changed to BMP - with double click over the cell of the table from column "File extention:". If a rectangular area from the diagram is needed to be uploaded to FTP server as picture, add a Frame from Other top icon and check it at list of Available controls, then all the image inside it will be converted as image file.

Files for upload - all the added files at this table will be uploaded to FTP server.

Files from folder - this group has two settings:
- Local folder with files for upload. With the current example c:\xxx\*.zip - all the ZIP files from the computer folder c:\xxx will be uploaded to the FTP server.
- Upload to FTP folder - where the files will be uploaded;

FTPUploader Demo diagram (FTP.nsm included in demo diagrams):

As is visible from the demo diagram, three controls are choosen to be uploaded to FTP server - they are checked in the table Available controls:
- Scope;
- WEBCam - the current image from the WEB can be easy published on WEB site;
- Frame - just add a frame to the diagram and all the image inside it will be uploaded to FTP server. A Frame can be added from third icon from top ribbon bar - Other;




Block InternetChecker

Tests the computer’s internet connection. The block tries to ping first URL, then second. If both do not reply the output gets low level which means there is no internet.


  • FirstURL - the first internet address for ping;
  •  SecondURL - the second internet address for ping. Optional;
  • CheckPerMin - the first and second URL will be checked at a period of the entered number of minutes;
  • WithOutStringInRes – Some WiFi routers would return to the computers an HTML with information that the connection is lost when this happens. If the text in this parameter exists in the returned text from the URL this would mean the router has lost connection;
  • ShowMessageOnCheck - Show a text message on the right blue area of the application whenever a connection check occurs;
  • WriteHTMLToFile - Write the received HTML to a file called NiSimIChecker.txt in the current directory of NiSim.exe;