Forms

Form Actions

Dijon Platform allows you to undertake actions after a form is submitted. This is useful for sending "Thank You" emails for donations or leads.

These emails are actions which are defined in the form configuration.

sendDonationEmail

Works with Payment forms

Confirmation emails on payment are sent by defining the form action sendDonationEmail. These emails are sent to the address entered in the payment form.

In the age of GDPR, you will want to ensure you only send emails to donors when they have opted in to receive them. Look at the actions section in our example below. We have checkbox on our form called opt_in which users check to confirm they wish to receive emails from us. This bit of form configuration ensures we only send emails when this checkbox is checked, confirming that we have permission to send emails to this user.

Example
$config->addForm([
    'name' => 'good_causes_donate',
    'type' => Form::TYPE_DONATION,
    'description' => 'Good causes one-off donation form',
    'paymentDescription' => 'Good causes one-off donation',
    'successPath' => '/thank_you',
    'fields' => [
        'utm_source' => [],
        'opt_in' => []
    ],
    'actions' => [
        'sendDonationEmail' => [
            'require' => [
                'fieldsOr' => [
                    'opt_in'
                ]
            ]
        ]
    ],
    'mandrillEmail' => [
        'template_name' => 'dijon-donation-en',
        'subject' => 'Thank you for donating to Good Causes',
        'from_address' => 'info@dijonplatform.com',
        'from_name' => "Good Causes from Dijon Platform",
    ],
    'campaign' => 'donate',
]);

Our example above uses MailChimp's Transactional email service (also known as Mandrill) to send emails. We are using the template named dijon-donation-en which must exist in the connected Mandrill account.

Dijon passes the following mail merge variables to the Mandrill templates:

  • *|NAME|* the full name of the person who made the payment
  • *|FIRST_NAME|* the first name of the person who made the payment
  • *|payment_amount|* the amount that was paid in the currency it was paid in
  • *|currency|* the three letter currency code for the currency the payment was made in
  • *|currency_symbol|* the currency symbol for the currency the payment was made in

e.g. you would use *|currency_symbol|**|payment_amount|* in your Mandrill template to get £50.00 in the email.

Mandrill templates, from name, from address and subjects can also be specified using settings. These will override what you have set in site_config.php.

On this page