Preconfiguration "Sending the e-mails by the application"

Creates object PmFolder with methods and panel for sending e-mails from the application.
This preconfiguration can be activated when creating a new object (e.g. by "New object" in the local object menu or by pressing the Insert key after selecting the object) and is included in the group: " / Communication / Email, SMS messages, Maatrix".

This preconfiguration can be used with the objects: PmFolder or PmRoot.

- Preconfiguration creates an object of type PmFolder containing the SendEmail method with the sTo, sSubject, sBody parameters. At the start, there are variables that set the SMTP server connection and at the end the SendEmailCDO method is called that send the message.
- The preconfiguration also includes a graphic panel, but it is not necessary for sending messages. It contains graphic items used for entering the receiver e-mail address, the messasge subject and the message body. There is also a PmiButton item, that calls the SendEmail method with the defined values on the onButtonUp event..
- In the window that appears before the object is created, it is necessary to enter the information needed for SMTP server configuration and message sender identification.
- The preconfiguration is created including the panel (PmPanel object) functionality as a Web panel. In order to make the preconfiguration functional also for the Web, it is necessary to enable the PmPanel object for the Web (on the Web server page).
The panel method SendEmail can be called anywhere from the application.
These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the application object tree. This is a system name and must not contain diacritics, empty string, spaces and the first character must not be a number.

Default: "SendEmail"

SMTP server address
Your UserID on the SMTP server
Your password on the SMTP server
Name sender
Mail address sender
Script for sending an e-mail:
VBScriptSelect and copy to clipboard

Dim nSendUsing, oMsg, oFlds, nSmtpAuthenticate, sSmtpServer, sUserName, sPassword, nSmtpServerPort, bSmtpUseSsl, nSmtpConnectionTimeout

nSendUsing = 2  '1 = Send message using the local SMTP service pickup directory, 2 = Send the message using the network (SMTP over the network)
sSmtpServer = ""  'Name or IP address of Remote SMTP Server
nSmtpAuthenticate = 1  'Type of authentication, NONE=0, Basic=1 (Base64 encoded), NTLM=2
sUserName = "My Name" & "<>"  'Your UserID on the SMTP server
sPassword = "******"  'Your password on the SMTP server
nSmtpServerPort = 25  'Server port (typically 25)
bSmtpUseSsl = false  'Use SSL for the connection (false or true)
nSmtpConnectionTimeout = 60  'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)

Set oMsg = CreateObject("CDO.Message")
oMsg.BodyPart.Charset = "utf-8"  '"windows-1252" or "iso-8859-2" / ...
oMsg.Subject = "Test email from Promotic"
oMsg.From = "Name" & "<>"
oMsg.To = ""
oMsg.TextBody = "Test email from Promotic.." & vbCrLf & "It was sent using SMTP authentication"
'oMsg.HTMLBody = "<h1>Test email from Promotic..</h1><p>It was sent using SMTP authentication.</p>
oMsg.Addattachment = "c:\temp\Text.txt"

'==This section provides the configuration information for the remote SMTP server==
Set oFlds = oMsg.Configuration.Fields
oFlds.Item("") = nSendUsing
oFlds.Item("") = sSmtpServer
oFlds.Item("") = nSmtpAuthenticate
oFlds.Item("") = sUserName
oFlds.Item("") = sPassword
oFlds.Item("") = nSmtpServerPort
oFlds.Item("") = bSmtpUseSsl
oFlds.Item("") = nSmtpConnectionTimeout
'==End remote SMTP server configuration section==

PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice