This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
There is no license information available for the latest version (dev-master) of this package.

This module bundles the emailing process into a form object. It also supports the routing of emails to a test address.

dev-master 2015-04-02 11:07 UTC

This package is not auto-updated.

Last update: 2021-11-22 12:09:46 UTC


This module bundles the emailing process into a form object. It also lets you route emails to a test address for manual testing of an email form.


Build the form as usual, but with EmailingForm::create() instead of Form::create(). EmailingForm exposes setting up the email via the form object.

public function ContactForm() {

    // ...

    $form = EmailingForm::create(
        $this, 'ContactForm', $fields, $actions

    $form->setFrom('Me <>');

    return $form;

Then in the form action simply do:

public function SendForm($data, $form){

The Send method will automatically sanitize the data for you before loading it into the template.

Test conditions

This module can be configured to route test emails to a test address for manual form testing. In your main project, configure the EmailTools object in your _config.php:


Then when you're setting up the form as shown in the usage example do:

$form->setTestCondition(function($e, $data)
    return EmailTools::isTestData($data['Email']);

The module passes the submitted $data to this callback, if it is set. In this example, we're checking the input data 'Email', however you can check any field you like. If this callback returns true, EmailingForm will route your email to your test address.