Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

examples package: Creating HTML using a Velocity template

The examples package contains services that collectively demonstrate how to parse Apache Velocity templates using one-liners from VelocityMethods. In particular, these services parse a template and sends the resulting HTML result as an email using one-liners from EmailMethods.

Related articles

Please see the following articles for more information:

Try it!

In the Navigator, expand the examples package and navigate to the code folder, then expand the velocity package. This package contains the following files and directories, as shown below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
examples
├── ...
└── code
    └── velocity
        ├── invoke
        │   └── InvokeSendEmail.gloop
        ├── model
        │   └── Person.model
        └── service
            └── SendEmail.gloop

The velocity.invoke.InvokeSendEmail.gloop service is the service that you can run to be able to parse a template and send it as an email. Under the covers, it calls velocity.service.SendEmail.gloop, which does the actual job of parsing the template and sending the email. The call is only wrapped to make the code easier to understand. Basically, velocity.invoke.InvokeSendEmail.gloop is in charge of setting the arguments required by velocity.service.SendEmail.gloop.

The credentials used for sending the email and to whom it will be sent will depend on the configured package properties, which must be set before invoking velocity.invoke.InvokeSendEmail.gloop.

Configure required package properties first

Before invoking velocity.invoke.InvokeSendEmail.gloop, the following required package properties must be set:

Name Description
login Email to use for authentication
password Password to use for authentication
from The sender of the email
to The receiver of the email

Some of these properties are already populated but you can change their values and set them to whatever you like.

After running velocity.invoke.InvokeSendEmail.gloop, you should receive a message in the email address you've configured in package.properties. It will look similar to the image below:

Rendered velocity template sent to the email your configured