Sending and checking emails has long been a part of our everyday lives. Then why not use such a simple practice to effectively communicate business information?

Jedox already gives us an example of such functionality. The Budget Data Entry web report (Bikers Best) offers the possibility of sending a customized email when budget data is submitted and revised. This functionality is implemented in Jedox Web by assigning macros to buttons. Within each macro, there is a small piece of code that triggers a mail pop-up. For instance, the code below will result in the notification displayed in Image 1.


Image 1. Budget Data Entry – Report Manager.

All good, but what if you want these notifications to be sent automatically in the background while continuing to work? What if there are more than one recipient? You would have to know beforehand who these people are, then manually add their addresses into the ‘To’ line. Or what about a notification sent to a bunch full of people when a project deadline is near? It is such a hassle that eats up time where you could be dealing with other issues.

Having this in mind, I started researching on the possibility to send out automatic mails using a Groovy script. Groovy actually makes a task like this fairly easy. You can send mail for any address from any network using your business email account. One of the best things about Groovy is that it can make use of all the Java libraries that already exist for doing things like connecting to mail servers. To test the functionality, I used the JavaMail libraries to connect to Google’s SMTP server and send a short email from my Gmail account. Here are some of the basics. Google’s SMTP server is a portable SMTP server (described in RFC 5321). Google’s SMTP server uses SMTP settings for sending mail through Gmail. The server settings are:

• server address:
• user name: Your full Gmail address (e.g.
• password: Your Gmail password
• port: 587(TLS)
• TLS/SSL required: yes

First of all, you need to import the JavaMail libraries for initiating a JavaMail connection.

Next step is to make a mail account object and set it to

Then set the SMTP server settings for the mail session. Some of the things to consider while settings these properties:

• SSL encryption is started by STARTTLS protocol (described in RFC 3207)

• The setting is needed in the script to avoid the error “Could not convert socket to TLS”

• SMTP uses port 587 for mail submission (described in RFC 6409)

Once you have those properties set, you can create a session and connect to the Gmail SMTP server.


Once you’re connected to the server, you can interact with Gmail as if it were any regular SMTP server. Below you can find the complete Groovy script.

Within the script, set the address and password of the sender together with the address of the recipient. Paste the customized code into a Groovy type job in ETL, then run it.