Skip to content

Overview

Development

Overview

IDEs

API Explorer

examples Package: Parsing an HTML Template Using Velocity

Introduction

The examples package contains example services that collectively demonstrate how to parse HTML templates using the VelocityMethods one-liners that are exposed to Gloop. In our example here, we would parse the HTML template and send it as an email using the one-liners in EmailMethods.

Related articles

Please see the following articles for more information:

Try It!

Under the Coder Navigator, expand the examples package entry and navigate to the code folder. Afterwards, look for the velocity package. This package contains the following files and directories, 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 should run to be able to parse the HTML template and send it as an email. Underneath the covers, it calls velocity.service.SendEmail.gloop, which does the actual job of parsing the template and sending the email. The call was 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 to make the call.

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 filled-out but you can change their values and set them to whatever you would like.

After running velocity.invoke.InvokeSendEmail.gloop, you should receive a message to the email address you configured in the package properties that looks like the image below.

Rendered velocity template sent to the email your configured