Difference between revisions of "SMTPSERVER"
Jump to navigation
Jump to search
Line 44: | Line 44: | ||
|- | |- | ||
− | | | + | |mail |
− | | | + | |JSON string |
|R | |R | ||
− | | | + | |a forced event generated when an email message is received.<br>The event's value is a JSON object containing all headers and the message body.<br>The body is arranged as an array of the first 64 lines od the body text. Lines after the 64th are ignored. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
− | + | The following code in Events is an example of how to parse the event's value, assuming "smtp" is the SMTP I/O Server's ID: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
− | function | + | function IOEvent(name, value) : { |
− | + | if (__run == 1 && name == "smtp.mail") { | |
− | + | var mail = JSON.parse(value); | |
− | + | messageLog("From: " + mail.from); | |
+ | messageLog("To: " + mail.to); | ||
+ | messageLog("Date: " + mail.date); | ||
+ | messageLog("Subject: " + mail.subject); | ||
+ | for (i = 0; i < mail.body.length; i++) { | ||
+ | messageLog("Body Line " + (i + 1) + ": " + mail.body[i]); | ||
+ | } | ||
+ | } | ||
} | } | ||
</pre> | </pre> |
Revision as of 18:03, 25 January 2016
The SMTP I/O Server implements a very basic Simple Mail Transfer Protocol (SMTP) server based on a subset of the RFC 821 standard. The SMTP I/O Server is not intended to be used as an ordinary SMTP server in the open Internet, but as an internal server, inside a protected network and not accessible from unknown clients, for SMTP-based M2M communication, or for testing purposes.
Contents
HSYCO Configuration
Add an SMTP I/O Server in the I/O Servers section of the Settings and set its parameters:
Communication
n/a
High Availability
- Shutdown when inactive: defaults to false.
Options
ID | Default | Values | Description |
---|---|---|---|
port | 25 | 1...65535 | the SMTP port number. The server listens on the specified port of all available network interfaces. |
threads | 4 | > 0 | the maximum number of concurrent active server threads (equivalent to connected clients). |
Datapoints
ID | Value | R/W | Description |
---|---|---|---|
JSON string | R | a forced event generated when an email message is received. The event's value is a JSON object containing all headers and the message body. The body is arranged as an array of the first 64 lines od the body text. Lines after the 64th are ignored. |
The following code in Events is an example of how to parse the event's value, assuming "smtp" is the SMTP I/O Server's ID:
function IOEvent(name, value) : { if (__run == 1 && name == "smtp.mail") { var mail = JSON.parse(value); messageLog("From: " + mail.from); messageLog("To: " + mail.to); messageLog("Date: " + mail.date); messageLog("Subject: " + mail.subject); for (i = 0; i < mail.body.length; i++) { messageLog("Body Line " + (i + 1) + ": " + mail.body[i]); } } }
Release Notes
3.5.1
- initial release
ARTECO is a registered trademark of Arteco Srl.