ETL: Mail2
Table of Contents
Description
Driver for sending email to recipients via SMTP.
Connection
This driver uses the SMTP connection defined on the Settings page. For more information on how to set up and test the SMTP connection please refer to SMTP Email Server Connection.
Attributes
Name | Description | Required |
---|---|---|
url | List of recipients in format: "mailto:address1@somecompany.com,address2@somecompany.com" | yes |
Parameters
Name | Description | Required | Default |
---|---|---|---|
type | Type of the E-Mail message content: text or html | no | text |
subject | The subject text of the email | no |
Query
Not used.
Script
Send prepared string by email via SMTP server. Send as text or html based on configuration.
Examples
ETL job sends constant string to recipients.
<!DOCTYPE etl SYSTEM "
https://scriptella.org/dtd/etl.dtd
">
<
etl
>
<
connection
id
=
"mail"
driver
=
"mail2"
url
=
"mailto:address1@somecompany.com,address2@somecompany.com"
classpath
=
"mail.jar:activation.jar"
>
type=text
subject=Mail test
</
connection
>
<
script
connection-id
=
"mail"
>
<![CDATA[This is a test of the Mail2 email driver]]>
</
script
>
</
etl
>
ETL job sends result of Neo4j Cypher query in one mail message.
<!DOCTYPE etl SYSTEM "
https://scriptella.org/dtd/etl.dtd
">
<
etl
>
<
connection
id
=
"mail"
driver
=
"mail2"
url
=
"mailto:address1@somecompany.com"
classpath
=
"mail.jar:activation.jar"
>
type=html
subject=Mail test
</
connection
>
<
connection
id
=
"neo4j"
driver
=
"neo4j"
url
=
"http://localhost:7474/"
user
=
"neo4j"
password
=
"admin"
>
queryEmptyValue=
</
connection
>
<
connection
id
=
"groovy"
driver
=
"script"
>language=groovy</
connection
>
<
script
connection-id
=
"groovy"
>
<![CDATA[
etl.globals['text'] = '<table>'
]]>
</
script
>
<
query
connection-id
=
"neo4j"
>
MATCH (n) RETURN id(n) as id, labels(n) as labels limit 25
<
script
connection-id
=
"groovy"
>
<![CDATA[
etl.globals['text'] = etl.globals['text'] + '<tr>' + '<td>' + id + '</td>' + '<td>' + labels + '</td>' + '</tr>'
]]>
</
script
>
</
query
>
<
script
connection-id
=
"groovy"
>
<![CDATA[
etl.globals['text'] = etl.globals['text'] + '</table>'
]]>
</
script
>
<
script
connection-id
=
"mail"
>
<![CDATA[
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
]]>
result of query MATCH (n) RETURN id(n) as id, labels(n) as labels limit 25
${etl.globals['text']}
<![CDATA[
</body>
</html>
]]>
</
script
>
</
etl
>