Send a copy of the email to the form user

This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.

Optionally send a copy if they tick a checkbox

Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
3456
7
8
9
10
11
12
13
14
function my_send_form_user_copy($mailer, $form, $attachments)
{
    $checkbox = $form->getValue('iphorm_2_4');    if (isset($checkbox[0]) && $checkbox[0] == 'Send me a copy of the form data') {        $email = $form->getValue('iphorm_2_3');        if ($email) {
            $mailer->AddAddress($email);
            $mailer->SingleTo = true; // Hide the recipient email addresses from each other
        }
    }
 
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_send_form_user_copy', 10, 3);
function my_send_form_user_copy($mailer, $form, $attachments)
{
    $checkbox = $form->getValue('iphorm_2_4');
    if (isset($checkbox[0]) && $checkbox[0] == 'Send me a copy of the form data') {
        $email = $form->getValue('iphorm_2_3');
        if ($email) {
            $mailer->AddAddress($email);
            $mailer->SingleTo = true; // Hide the recipient email addresses from each other
        }
    }

    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_send_form_user_copy', 10, 3);

Modify the code to suit your form setup.

  • On line 3, change iphorm_2_4 to the unique ID of the Checkbox element that the user should tick to receive a copy
  • On line 4, change Send me a copy of the form data to the value of the checkbox option that the user will tick
  • On line 5, change iphorm_2_3 to the unique ID of the Email Address element
  • On line 14, change the number 2 to the form ID

Always send a copy

Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
34
5
6
7
8
9
10
11
function my_send_form_user_copy($mailer, $form, $attachments)
{
    $email = $form->getValue('iphorm_2_3');    if ($email) {
        $mailer->AddAddress($email);
        $mailer->SingleTo = true; // Hide the recipient email addresses from each other
    }
 
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_send_form_user_copy', 10, 3);
function my_send_form_user_copy($mailer, $form, $attachments)
{
    $email = $form->getValue('iphorm_2_3');
    if ($email) {
        $mailer->AddAddress($email);
        $mailer->SingleTo = true; // Hide the recipient email addresses from each other
    }

    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_send_form_user_copy', 10, 3);

Modify the code to suit your form setup.

  • On line 3, change iphorm_2_3 to the unique ID of the Email Address element
  • On line 11, change the number 2 to the form ID
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy