API Docs - v2.0.4
Tested Siddhi Core version: 5.1.5
It could also support other Siddhi Core minor versions.
Sink
email (Sink)
The email sink uses the 'smtp' server to publish events via emails. The events can be published in 'text', 'xml' or 'json' formats. The user can define email sink parameters in either the '<SP_HOME>/conf/<PROFILE>/deployment yaml' file or in the stream definition. The email sink first checks the stream definition for parameters, and if they are no configured there, it checks the 'deployment.yaml' file. If the parameters are not configured in either place, default values are considered for optional parameters. If you need to configure server system parameters that are not provided as options in the stream definition, then those parameters need to be defined them in the 'deployment.yaml' file under 'email sink properties'.
For more information about the SMTP server parameters, see https://javaee.github.io/javamail/SMTP-Transport.
Further, some email accounts are required to enable the 'access to less secure apps' option. For gmail accounts, you can enable this option via https://myaccount.google.com/lesssecureapps.
@sink(type="email", username="<STRING>", address="<STRING>", password="<STRING>", host="<STRING>", port="<INT>", ssl.enable="<BOOL>", auth="<BOOL>", content.type="<STRING>", subject="<STRING>", to="<STRING>", cc="<STRING>", bcc="<STRING>", attachments="<STRING>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
username | The username of the email account that is used to send emails. |
STRING | No | No | |
address | The address of the email account that is used to send emails. |
STRING | No | No | |
password | The password of the email account. |
STRING | No | No | |
host | The host name of the SMTP server. e.g., 'smtp.gmail.com' is a host name for a gmail account. The default value 'smtp.gmail.com' is only valid if the email account is a gmail account. |
smtp.gmail.com | STRING | Yes | No |
port | The port that is used to create the connection. |
'465' the default value is only valid is SSL is enabled. | INT | Yes | No |
ssl.enable | This parameter specifies whether the connection should be established via a secure connection or not. The value can be either 'true' or 'false'. If it is 'true', then the connection is establish via the 493 port which is a secure connection. |
true | BOOL | Yes | No |
auth | This parameter specifies whether to use the 'AUTH' command when authenticating or not. If the parameter is set to 'true', an attempt is made to authenticate the user using the 'AUTH' command. |
true | BOOL | Yes | No |
content.type | The content type can be either 'text/plain' or 'text/html'. |
text/plain | STRING | Yes | No |
subject | The subject of the mail to be send. |
STRING | No | Yes | |
to | The address of the 'to' recipient. If there are more than one 'to' recipients, then all the required addresses can be given as a comma-separated list. |
STRING | No | Yes | |
cc | The address of the 'cc' recipient. If there are more than one 'cc' recipients, then all the required addresses can be given as a comma-separated list. |
None | STRING | Yes | No |
bcc | The address of the 'bcc' recipient. If there are more than one 'bcc' recipients, then all the required addresses can be given as a comma-separated list. |
None | STRING | Yes | No |
attachments | File paths of the files that need to be attached to the email. |
None | STRING | Yes | Yes |
System Parameters
Name | Description | Default Value | Possible Parameters |
---|---|---|---|
mail.smtp.ssl.trust | If this parameter is se, and a socket factory has not been specified, it enables the use of a MailSSLSocketFactory. If this parameter is set to "", all the hosts are trusted. If it is set to a whitespace-separated list of hosts, only those specified hosts are trusted. If not, the hosts trusted depends on the certificate presented by the server. |
String | |
mail.smtp.connectiontimeout | The socket connection timeout value in milliseconds. |
infinite timeout | Any Integer |
mail.smtp.timeout | The socket I/O timeout value in milliseconds. |
infinite timeout | Any Integer |
mail.smtp.from | The email address to use for the SMTP MAIL command. This sets the envelope return address. |
Defaults to msg.getFrom() or InternetAddress.getLocalAddress(). | Any valid email address |
mail.smtp.localport | The local port number to bind to when creating the SMTP socket. |
Defaults to the port number picked by the Socket class. | Any Integer |
mail.smtp.ehlo | If this parameter is set to 'false', you must not attempt to sign in with the EHLO command. |
true | true or false |
mail.smtp.auth.login.disable | If this is set to 'true', it is not allowed to use the 'AUTH LOGIN' command. |
false | true or false |
mail.smtp.auth.plain.disable | If this parameter is set to 'true', it is not allowed to use the 'AUTH PLAIN' command. |
false | true or false |
mail.smtp.auth.digest-md5.disable | If this parameter is set to 'true', it is not allowed to use the 'AUTH DIGEST-MD5' command. |
false | true or false |
mail.smtp.auth.ntlm.disable | If this parameter is set to 'true', it is not allowed to use the 'AUTH NTLM' command |
false | true or false |
mail.smtp.auth.ntlm.domain | The NTLM authentication domain. |
None | The valid NTLM authentication domain name. |
mail.smtp.auth.ntlm.flags | NTLM protocol-specific flags. For more details, see http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags. |
None | Valid NTLM protocol-specific flags. |
mail.smtp.dsn.notify | The NOTIFY option to the RCPT command. |
None | Either 'NEVER', or a combination of 'SUCCESS', 'FAILURE', and 'DELAY' (separated by commas). |
mail.smtp.dsn.ret | The 'RET' option to the 'MAIL' command. |
None | Either 'FULL' or 'HDRS'. |
mail.smtp.sendpartial | If this parameter is set to 'true' and a message is addressed to both valid and invalid addresses, the message is sent with a log that reports the partial failure with a 'SendFailedException' error. If this parameter is set to 'false' (which is default), the message is not sent to any of the recipients when the recipient lists contain one or more invalid addresses. |
false | true or false |
mail.smtp.sasl.enable | If this parameter is set to 'true', the system attempts to use the 'javax.security.sasl' package to choose an authentication mechanism for the login. |
false | true or false |
mail.smtp.sasl.mechanisms | Enter a space or a comma-separated list of SASL mechanism names that the system shouldt try to use. |
None | |
mail.smtp.sasl.authorizationid | The authorization ID to be used in the SASL authentication. If no value is specified, the authentication ID (i.e., username) is used. |
username | Valid ID |
mail.smtp.sasl.realm | The realm to be used with the 'DIGEST-MD5' authentication. |
None | |
mail.smtp.quitwait | If this parameter is set to 'false', the 'QUIT' command is issued and the connection is immediately closed. If this parameter is set to 'true' (which is default), the transport waits for the response to the QUIT command. |
false | true or false |
mail.smtp.reportsuccess | If this parameter is set to 'true', the transport to includes an 'SMTPAddressSucceededException' for each address to which the message is successfully delivered. |
false | true or false |
mail.smtp.socketFactory | If this parameter is set to a class that implements the 'javax.net.SocketFactory' interface, this class is used to create SMTP sockets. |
None | Socket Factory |
mail.smtp.socketFactory.class | If this parameter is set, it specifies the name of a class that implements the 'javax.net.SocketFactory interface'. This class is used to create SMTP sockets. |
None | |
mail.smtp.socketFactory.fallback | If this parameter is set to 'true', the failure to create a socket using the specified socket factory class causes the socket to be created using the 'java.net.Socket' class. |
true | true or false |
mail.smtp.socketFactory.port | This specifies the port to connect to when using the specified socket factory. |
25 | Valid port number |
mail.smtp.ssl.protocols | This specifies the SSL protocols that need to be enabled for the SSL connections. |
None | This parameter specifies a whitespace separated list of tokens that are acceptable to the 'javax.net.ssl.SSLSocket.setEnabledProtocols' method. |
mail.smtp.starttls.enable | If this parameter is set to 'true', it is possible to issue the 'STARTTLS' command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. |
false | true or false |
mail.smtp.starttls.required | If this parameter is set to 'true', it is required to use the 'STARTTLS' command. If the server does not support the 'STARTTLS' command, or if the command fails, the connection method will fail. |
false | true or false |
mail.smtp.socks.host | This specifies the host name of a SOCKS5 proxy server to be used for the connections to the mail server. |
None | |
mail.smtp.socks.port | This specifies the port number for the SOCKS5 proxy server. This needs to be used only if the proxy server is not using the standard port number 1080. |
1080 | valid port number |
mail.smtp.auth.ntlm.disable | If this parameter is set to 'true', the AUTH NTLM command cannot be issued. |
false | true or false |
mail.smtp.mailextension | The extension string to be appended to the MAIL command. |
None | |
mail.smtp.userset | If this parameter is set to 'true', you should use the 'RSET' command instead of the 'NOOP' command in the 'isConnected' method. In some scenarios, 'sendmail' responds slowly after many 'NOOP' commands. This is avoided by using 'RSET' instead. |
false | true or false |
Examples EXAMPLE 1
@sink(type='email', @map(type ='json'), username='sender.account', address='sender.account@gmail.com',password='account.password',subject='Alerts from Wso2 Stream Processor',to='{{email}}',)define stream FooStream (email string, loginId int, name string);
This example illustrates how to publish events via an email sink based on the values provided for the mandatory parameters. As shown in the example, it publishes events from the 'FooStream' in 'json' format as emails to the specified 'to' recipients via the email sink. The email is sent from the 'sender.account@gmail.com' email address via a secure connection.
EXAMPLE 2
@sink(type='email', @map(type ='json'), subject='Alerts from Wso2 Stream Processor',to='{{email}}',)define stream FooStream (email string, loginId int, name string);
This example illustrates how to configure the query parameters and the system parameters in the 'deployment.yaml' file.
Corresponding parameters need to be configured under 'email', and namespace:'sink' as follows:
siddhi: extensions:
- extension:
name:'email'
namespace:'sink'
properties:
username: <sender's email username>
address: <sender's email address>
password: <sender's email password>
As shown in the example, events from the FooStream are published in 'json' format via the email sink as emails to the given 'to' recipients. The email is sent from the 'sender.account@gmail.com' address via a secure connection.
EXAMPLE 3
@sink(type='email', @map(type ='json'), username='sender.account', address='sender.account@gmail.com',password='account.password',host='smtp.gmail.com',port='465',ssl.enable='true',auth='true',content.type='text/html',subject='Alerts from Wso2 Stream Processor-{{name}}',to='to1.account@gmail.com, to2.account@gmail.com',cc='cc1.account@gmail.com, cc2.account@gmail.com',bcc='bcc1.account@gmail.com)define stream FooStream (name string, age int, country string);
This example illustrates how to publish events via the email sink. Events from the 'FooStream' stream are published in 'xml' format via the email sink as a text/html message and sent to the specified 'to', 'cc', and 'bcc' recipients via a secure connection. The 'name' namespace in the 'subject' attribute is the value of the 'name' parameter in the corresponding output event.
EXAMPLE 4
@sink(type='email', @map(type ='json'), username='sender.account', address='sender.account@gmail.com',password='account.password',host='smtp.gmail.com',port='465',ssl.enable='true',auth='true',content.type='text/html',subject='Alerts from Wso2 Stream Processor-{{name}}',to='to1.account@gmail.com, to2.account@gmail.com',cc='cc1.account@gmail.com, cc2.account@gmail.com',bcc='bcc1.account@gmail.comattachments= '{{attachments}}')define stream FooStream (name string, age int, country string, attachments string);
This example illustrates how to publish events via the email sink. Here, the email also contains attachments.
Events from the FooStream are published in 'xml' format via the email sink as a 'text/html' message to the specified 'to','cc', and 'bcc' recipients via a secure connection. The 'name' namespace in the 'subject' attribute is the value for the 'name' parameter in the corresponding output event.
The attachments included in the email message are the local files available in the path specified as the value for the 'attachments' attribute.
Source
email (Source)
The 'Email' source allows you to receive events via emails. An 'Email' source can be configured using the 'imap' or 'pop3' server to receive events. This allows you to filter the messages that satisfy the criteria specified under the 'search term' option. The email source parameters can be defined in either the '<SP_HOME>/conf/<PROFILE>/deployment yaml' file or the stream definition. If the parameter configurations are not available in either place, the default values are considered (i.e., if default values are available). If you need to configure server system parameters that are not provided as options in the stream definition, they need to be defined in the 'deployment yaml' file under 'email source properties'. For more information about 'imap' and 'pop3' server system parameters, see the following.
JavaMail Reference Implementation - IMAP Store
JavaMail Reference Implementation - POP3 Store Store
@source(type="email", username="<STRING>", password="<STRING>", store="<STRING>", host="<STRING>", port="<INT>", folder="<STRING>", search.term="<STRING>", polling.interval="<LONG>", action.after.processed="<STRING>", folder.to.move="<STRING>", content.type="<STRING>", ssl.enable="<BOOL>", @map(...)))
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
username | The user name of the email account. e.g., 'wso2mail' is the username of the 'wso2mail@gmail.com' mail account. |
STRING | No | No | |
password | The password of the email account |
STRING | No | No | |
store | The store type that used to receive emails. Possible values are 'imap' and 'pop3'. |
imap | STRING | Yes | No |
host | The host name of the server (e.g., 'imap.gmail.com' is the host name for a gmail account with an IMAP store.). The default value 'imap.gmail.com' is only valid if the email account is a gmail account with IMAP enabled. |
If store type is 'imap', then the default value is 'imap.gmail.com'. If the store type is 'pop3', then thedefault value is 'pop3.gmail.com'. | STRING | Yes | No |
port | The port that is used to create the connection. |
'993', the default value is valid only if the store is 'imap' and ssl-enabled. | INT | Yes | No |
folder | The name of the folder to which the emails should be fetched. |
INBOX | STRING | Yes | No |
search.term | The option that includes conditions such as key-value pairs to search for emails. In a string search term, the key and the value should be separated by a semicolon (';'). Each key-value pair must be within inverted commas (' '). The string search term can define multiple comma-separated key-value pairs. This string search term currently supports only the 'subject', 'from', 'to', 'bcc', and 'cc' keys. e.g., if you enter 'subject:DAS, from:carbon, bcc:wso2', the search term creates a search term instance that filters emails that contain 'DAS' in the subject, 'carbon' in the 'from' address, and 'wso2' in one of the 'bcc' addresses. The string search term carries out sub string matching that is case-sensitive. If '@' in included in the value for any key other than the 'subject' key, it checks for an address that is equal to the value given. e.g., If you search for 'abc@', the string search terms looks for an address that contains 'abc' before the '@' symbol. |
None | STRING | Yes | No |
polling.interval | This defines the time interval in seconds at which th email source should poll the account to check for new mail arrivals.in seconds. |
600 | LONG | Yes | No |
action.after.processed | The action to be performed by the email source for the processed mail. Possible values are as follows: |
NONE | STRING | Yes | No |
folder.to.move | The name of the folder to which the mail must be moved once it is processed. If the action after processing is 'MOVE', it is required to specify a value for this parameter. |
STRING | No | No | |
content.type | The content type of the email. It can be either 'text/plain' or 'text/html.' |
text/plain | STRING | Yes | No |
ssl.enable | If this is set to 'true', a secure port is used to establish the connection. The possible values are 'true' and 'false'. |
true | BOOL | Yes | No |
System Parameters
Name | Description | Default Value | Possible Parameters |
---|---|---|---|
mail.imap.partialfetch | This determines whether the IMAP partial-fetch capability should be used. |
true | true or false |
mail.imap.fetchsize | The partial fetch size in bytes. |
16K | value in bytes |
mail.imap.peek | If this is set to 'true', the IMAP PEEK option should be used when fetching body parts to avoid setting the 'SEEN' flag on messages. The default value is 'false'. This can be overridden on a per-message basis by the 'setPeek method' in 'IMAPMessage'. |
false | true or false |
mail.imap.connectiontimeout | The socket connection timeout value in milliseconds. This timeout is implemented by 'java.net.Socket'. |
infinity timeout | Any Integer value |
mail.imap.timeout | The socket read timeout value in milliseconds. This timeout is implemented by 'java.net.Socket'. |
infinity timeout | Any Integer value |
mail.imap.writetimeout | The socket write timeout value in milliseconds. This timeout is implemented by using a 'java.util.concurrent.ScheduledExecutorService' per connection that schedules a thread to close the socket if the timeout period elapses. Therefore, the overhead of using this timeout is one thread per connection. |
infinity timeout | Any Integer value |
mail.imap.statuscachetimeout | The timeout value in milliseconds for the cache of 'STATUS' command response. |
1000ms | Time out in miliseconds |
mail.imap.appendbuffersize | The maximum size of a message to buffer in memory when appending to an IMAP folder. |
None | Any Integer value |
mail.imap.connectionpoolsize | The maximum number of available connections in the connection pool. |
1 | Any Integer value |
mail.imap.connectionpooltimeout | The timeout value in milliseconds for connection pool connections. |
45000ms | Any Integer |
mail.imap.separatestoreconnection | If this parameter is set to 'true', it indicates that a dedicated store connection needs to be used for store commands. |
true | true or false |
mail.imap.auth.login.disable | If this is set to 'true', it is not possible to use the non-standard 'AUTHENTICATE LOGIN' command instead of the plain 'LOGIN' command. |
false | true or false |
mail.imap.auth.plain.disable | If this is set to 'true', the 'AUTHENTICATE PLAIN' command cannot be used. |
false | true or false |
mail.imap.auth.ntlm.disable | If true, prevents use of the AUTHENTICATE NTLM command. |
false | true or false |
mail.imap.proxyauth.user | If the server supports the PROXYAUTH extension, this property specifies the name of the user to act as. Authentication to log in to the server is carried out using the administrator's credentials. After authentication, the IMAP provider issues the 'PROXYAUTH' command with the user name specified in this property. |
None | Valid string value |
mail.imap.localaddress | The local address (host name) to bind to when creating the IMAP socket. |
Defaults to the address picked by the Socket class. | Valid string value |
mail.imap.localport | The local port number to bind to when creating the IMAP socket. |
Defaults to the port number picked by the Socket class. | Valid String value |
mail.imap.sasl.enable | If this parameter is set to 'true', the system attempts to use the 'javax.security.sasl' package to choose an authentication mechanism for the login. |
false | true or false |
mail.imap.sasl.mechanisms | A list of SASL mechanism names that the system should to try to use. The names can be separated by spaces or commas. |
None | Valid string value |
mail.imap.sasl.authorizationid | The authorization ID to use in the SASL authentication. |
If this parameter is not set, the authentication ID (username) is used. | Valid string value |
mail.imap.sasl.realm | The realm to use with SASL authentication mechanisms that require a realm, such as 'DIGEST-MD5'. |
None | Valid string value |
mail.imap.auth.ntlm.domain | The NTLM authentication domain. |
None | Valid string value |
The NTLM authentication domain. | NTLM protocol-specific flags. |
None | Valid integer value |
mail.imap.socketFactory | If this parameter is set to a class that implements the 'javax.net.SocketFactory' interface, this class is used to create IMAP sockets. |
None | Valid SocketFactory |
mail.imap.socketFactory.class | If this parameter is set, it specifies the name of a class that implements the 'javax.net.SocketFactory' interface. This class is used to create IMAP sockets. |
None | Valid string |
mail.imap.socketFactory.fallback | If this parameter is set to 'true', failure to create a socket using the specified socket factory class results in the socket being created using the 'java.net.Socket' class. |
true | true or false |
mail.imap.socketFactory.port | This specifies the port to connect to when using the specified socket factory. If this parameter is not set, the default port is used. |
143 | Valid Integer |
mail.imap.ssl.checkserveridentity | If this parameter is set to 'true', the system checks the server identity as specified by RFC 2595. |
false | true or false |
mail.imap.ssl.trust | If this parameter is set and a socket factory has not been specified, it enables the use of a 'MailSSLSocketFactory'. |
Valid String | |
mail.imap.ssl.socketFactory | If this parameter is set to a class that extends the 'javax.net.ssl.SSLSocketFactory' class this class is used to create IMAP SSL sockets. |
None | SSL Socket Factory |
mail.imap.ssl.socketFactory.class | If this parameter is set, it specifies the name of a class that extends the 'javax.net.ssl.SSLSocketFactory' class. This class is used to create IMAP SSL sockets. |
None | Valid String |
mail.imap.ssl.socketFactory.port | This specifies the port to connect to when using the specified socket factory. |
the default port 993 is used. | valid port number |
mail.imap.ssl.protocols | This specifies the SSL protocols that are enabled for SSL connections. The property value is a whitespace-separated list of tokens acceptable to the 'javax.net.ssl.SSLSocket.setEnabledProtocols' method. |
None | Valid string |
mail.imap.starttls.enable | If this parameter is set to 'true', it is possible to use the 'STARTTLS' command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. |
false | true or false |
mail.imap.socks.host | This specifies the host name of a 'SOCKS5' proxy server that is used to connect to the mail server. |
None | Valid String |
mail.imap.socks.port | This specifies the port number for the 'SOCKS5' proxy server. This is needed if the proxy server is not using the standard port number 1080. |
1080 | Valid String |
mail.imap.minidletime | This property sets the delay in milliseconds. |
10 milliseconds | time in seconds (Integer) |
mail.imap.enableimapevents | If this property is set to 'true', it enables special IMAP-specific events to be delivered to the 'ConnectionListener' of the store. The unsolicited responses received during the idle method of the store are sent as connection events with 'IMAPStore.RESPONSE' as the type. The event's message is the raw IMAP response string. |
false | true or false |
mail.imap.folder.class | The class name of a subclass of 'com.sun.mail.imap.IMAPFolder'. The subclass can be used to provide support for additional IMAP commands. The subclass must have public constructors of the form 'public MyIMAPFolder'(String fullName, char separator, IMAPStore store, Boolean isNamespace) and public 'MyIMAPFolder'(ListInfo li, IMAPStore store) |
None | Valid String |
mail.pop3.connectiontimeout | The socket connection timeout value in milliseconds. |
Infinite timeout | Integer value |
mail.pop3.timeout | The socket I/O timeout value in milliseconds. |
Infinite timeout | Integer value |
mail.pop3.message.class | The class name of a subclass of 'com.sun.mail.pop3.POP3Message'. |
None | Valid String |
mail.pop3.localaddress | The local address (host name) to bind to when creating the POP3 socket. |
Defaults to the address picked by the Socket class. | Valid String |
mail.pop3.localport | The local port number to bind to when creating the POP3 socket. |
Defaults to the port number picked by the Socket class. | Valid port number |
mail.pop3.apop.enable | If this parameter is set to 'true', use 'APOP' instead of 'USER/PASS' to log in to the 'POP3' server (if the 'POP3' server supports 'APOP'). APOP sends a digest of the password instead of clearing the text password. |
false | true or false |
mail.pop3.socketFactory | If this parameter is set to a class that implements the 'javax.net.SocketFactory' interface, this class is used to create 'POP3' sockets. |
None | Socket Factory |
mail.pop3.socketFactory.class | If this parameter is set, it specifies the name of a class that implements the 'javax.net.SocketFactory' interface. This class is used to create 'POP3' sockets. |
None | Valid String |
mail.pop3.socketFactory.fallback | If this parameter is set to 'true', failure to create a socket using the specified socket factory class results in the socket being created using the 'java.net.Socket' class. |
false | true or false |
mail.pop3.socketFactory.port | This specifies the port to connect to when using the specified socket factory. |
Default port | Valid port number |
mail.pop3.ssl.checkserveridentity | If this parameter is set to 'true', check the server identity as specified by RFC 2595. |
false | true or false |
mail.pop3.ssl.trust | If this parameter is set and a socket factory has not been specified, it is possible to use a 'MailSSLSocketFactory'. |
Valid String | |
mail.pop3.ssl.socketFactory | If this parameter is set to a class that extends the 'javax.net.ssl.SSLSocketFactory' class, this class is used to create 'POP3' SSL sockets. |
None | SSL Socket Factory |
mail.pop3.ssl.checkserveridentity | If this parameter is set to 'true', the system checks the server identity as specified by 'RFC 2595'. |
false | true or false |
mail.pop3.ssl.trust | If this parameter is set and a socket factory has not been specified, it is possible to use a 'MailSSLSocketFactory'. |
Trust depends on the certificate presented by the server. | Valid String |
mail.pop3.ssl.socketFactory | If this parameter is set to a class that extends the 'javax.net.ssl.SSLSocketFactory' class, this class is used to create 'POP3 SSL' sockets. |
None | SSL Socket Factory |
mail.pop3.ssl.socketFactory.class | If this parameter is set, it specifies the name of a class that extends the 'javax.net.ssl.SSLSocketFactory' class. This class is used to create 'POP3 SSL' sockets. |
None | Valid String |
mail.pop3.ssl.socketFactory.p | This parameter pecifies the port to connect to when using the specified socket factory. |
995 | Valid Integer |
mail.pop3.ssl.protocols | This parameter specifies the SSL protocols that are enabled for SSL connections. The property value is a whitespace-separated list of tokens acceptable to the 'javax.net.ssl.SSLSocket.setEnabledProtocols' method. |
None | Valid String |
mail.pop3.starttls.enable | If this parameter is set to 'true', it is possible to use the 'STLS' command (if supported by the server) to switch the connection to a TLS-protected connection before issuing any login commands. |
false | true or false |
mail.pop3.starttls.required | If this parameter is set to 'true', it is required to use the 'STLS' command. The connect method fails if the server does not support the 'STLS' command or if the command fails. |
false | true or false |
mail.pop3.socks.host | This parameter specifies the host name of a 'SOCKS5' proxy server that can be used to connect to the mail server. |
None | Valid String |
mail.pop3.socks.port | This parameter specifies the port number for the 'SOCKS5' proxy server. |
None | Valid String |
mail.pop3.disabletop | If this parameter is set to 'true', the 'POP3 TOP' command is not used to fetch message headers. |
false | true or false |
mail.pop3.forgettopheaders | If this parameter is set to 'true', the headers that might have been retrieved using the 'POP3 TOP' command is forgotten and replaced by the headers retrieved when the 'POP3 RETR' command is executed. |
false | true or false |
mail.pop3.filecache.enable | If this parameter is set to 'true', the 'POP3' provider caches message data in a temporary file instead of caching them in memory. Messages are only added to the cache when accessing the message content. Message headers are always cached in memory (on demand). The file cache is removed when the folder is closed or the JVM terminates. |
false | true or false |
mail.pop3.filecache.dir | If the file cache is enabled, this property is used to override the default directory used by the JDK for temporary files. |
None | Valid String |
mail.pop3.cachewriteto | This parameter controls the behavior of the 'writeTo' method on a 'POP3' message object. If the parameter is set to 'true', the message content has not been cached yet, and the 'ignoreList' is null, the message is cached before being written. If not, the message is streamed directly to the output stream without being cached. |
false | true or false |
mail.pop3.keepmessagecontent | If this property is set to 'true', a hard reference to the cached content is retained, preventing the memory from being reused until the folder is closed, or until the cached content is explicitly invalidated (using the 'invalidate' method). |
false | true or false |
Examples EXAMPLE 1
@source(type='email', @map(type='xml'), username='receiver.account', password='account.password',)define stream inputStream (name string, age int, country string);
This example illustrates how to receive events in 'xml' format via the email source. In this example, only the required parameters are defined in the stream definition. The default values are taken for the other parameters. The search term is not defined, and therefore, all the new messages in the inbox folder are polled and taken.
EXAMPLE 2
@source(type='email', @map(type='xml'), username='receiver.account', password='account.password',store = 'imap',host = 'imap.gmail.com',port = '993',searchTerm = 'subject:Stream Processor, from: from.account@ , cc: cc.account',polling.interval='500',action.after.processed='DELETE',content.type='text/html,)define stream inputStream (name string, age int, country string);
This example illustrates how to receive events in 'xml' format via the email source. The email source polls the mail account every 500 seconds to check whether any new mails have arrived. It processes new mails only if they satisfy the conditions specified for the email search term (the value for 'from' of the email message should be 'from.account@.<host name>', and the message should contain 'cc.account' in the cc receipient list and the word 'Stream Processor' in the mail subject). in this example, the action after processing is 'DELETE'. Therefore,after processing the event, corresponding mail is deleted from the mail folder.