Forms: Add subject, CC and BCC

It’s fixed now. See this thread for more informations: Forms - What is the best way to pass mailer arguments? - solved

Now you can add this code to config/bootstrap.php or to an addon to change your mail settings:

<?php
$app->on('forms.submit.before', function($form, &$data, $frm, &$options) {
    
    // mail subject
    $options['subject'] = 'custom special mail subject';
    
    // add reply_to
    $options['reply_to'] = trim($data['mail']);
    
    // cc and bcc
    $options['cc'] = ['mail1@example.com', 'mail2@example.com'];
    $options['bcc'] = ['mail1@example.com', 'mail2@example.com'];
    
});

Have a look at lib/Mailer and Forms/bootstrap.php to see more possible options.

Or try

I added a simple templating system for mail subjects and I’ll add more options for CC, BCC etc. soon.

2 Likes