ETL: Mail2

Description

Send mail to recipients via SMTP with possible authentication for SMTP server. It is based on Scriptella Mail driver but send data over SMTP in other way.

Connection

Attributes

Name

Description

Required

url

List of recipients in format: "mailto:address1@somecompany.com,address2@somecompany.com"

yes

Parameters

Name

Description

Required

Default

mail.smtp.host

mail server

yes

 

mail.user

username for SMTP authentication

no

if not defined no authentication for SMTP

mail.password

password for SMTP authentication

no

if not defined no authentication for SMTP

mail.from

mail address of sender

yes

 

type

type of E-Mail message content: text / html

no

text

subject

subject of 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 "http://scriptella.org/dtd/etl.dtd">
<etl>
<connection id="mail" driver="mail2" url="mailto:address1@somecompany.com,address2@somecompany.com" classpath="mail.jar:activation.jar">
mail.smtp.host=smtp.gmail.com
mail.user=someuser
mail.password=somepassword
mail.from=Administrator
type=text
subject=Mail test
</connection>
 
<script connection-id="mail">
<![CDATA[This is test of mail driver]]>
</script>
</etl>

ETL job sends result of Neo4j Cypher query in one mail message.

<!DOCTYPE etl SYSTEM "http://scriptella.org/dtd/etl.dtd">
<etl>
<connection id="mail" driver="mail2" url="mailto:rudi.sb@gmail.com" classpath="mail.jar:activation.jar">
mail.smtp.host=smtp.gmail.com
mail.user=someuser
mail.password=somepassword
mail.from=Administrator
type=html
subject=Mail test
</connection>
<connection id="neo4j" driver="neo4j" url="http://localhost:7474/" user="neo4j" password="admin">
query_empty_value=
</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:Ci) RETURN id(n) as id, n.logicalName as logicalName limit 25
<script connection-id="groovy">
<![CDATA[
etl.globals['text'] = etl.globals['text'] + '<tr>' + '<td>' + id + '</td>' + '<td>' + logicalName + '</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:Ci) RETURN id(n) as id, n.logicalName as logicalName limit 25
${etl.globals['text']}
<![CDATA[
</body>
</html>
]]>
</script>
</etl>