After the post of Ana Stroe dealing with email sending using Groovy (thanks for that!), let’s see how to do the same using PHP!

The advantage of PHP in this case is that we can use the same function in a Jedox Web macro as well as in a Supervision-Server script. We’ll just have to include the correct files in Supervision-Server as well as the Apache directories.

The class we use is named PHPMailer. It can be downloaded from GitHub, here: and this is published under LGPL license.

Unzip the package and copy the class.* as well as the PHPMailerAutoload.php files in this directory:

<jedox install dir>/httpd/app/lib/phpmailer/ (this is for GNU/Linux)

</jedox install dir>httpapplibphpmailer (this is for Windows)

You can also create a dedicated directory, that’s what I did and called it phpmailer

We begin our script by including the necessary classes within our script:

I did not include the pop3 class because we want to send emails, not receive any. But this is also possible, of course.

Then everything works on the same principle as in the javax library :

We first create an instance of our PHPMailer object:

Then we set the authentification configuration properties of our object:

Then we set the properties of the email, like the subject, body, sender, recipient(s)…:

Recipients can be added using the AddAddress method:

Then shoot the mail by calling the send() method:

Here is the complete script with a couple of extra options. Of course you can adapt it to your needs, the class is well-documented.

Then we execute the sendThisEmail function using a button, as you already know.

For more flexibility, you can obviously store the data you need to send the email in a technical cube that you then query with the palo PHP functions.

To include the script in Supervision-Server just copy / paste the sendMail function and the libraries accordingly.

Have fun sending emails but beware of spam!