Adding extra data to the default notification email

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.

This guide will show you how to add the form URL and user IP address to the bottom of the default notification email. Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function my_custom_email_data($mailer, $form, $attachments)
{
    $formUrl = isset($_POST['form_url']) ? $_POST['form_url'] : '';
    $userIP = iphorm_get_user_ip();
 
    if ($formUrl) {
        $mailer->Body .= '<p>Form URL: <a href="' . esc_url($formUrl) . '">' . $formUrl . '</a></p>';
    }
 
    if ($userIP) {
        $mailer->Body .= '<p>User IP: ' . $userIP . '</p>';
    }
 
    // You must return the $mailer object
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_1', 'my_custom_email_data', 10, 3);
function my_custom_email_data($mailer, $form, $attachments)
{
	$formUrl = isset($_POST['form_url']) ? $_POST['form_url'] : '';
	$userIP = iphorm_get_user_ip();

	if ($formUrl) {
		$mailer->Body .= '<p>Form URL: <a href="' . esc_url($formUrl) . '">' . $formUrl . '</a></p>';
	}

	if ($userIP) {
		$mailer->Body .= '<p>User IP: ' . $userIP . '</p>';
	}

    // You must return the $mailer object
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_1', 'my_custom_email_data', 10, 3);
  • On line 17 change the number 1 to the form ID you want this to apply to. To apply this to all forms, remove the _1 from this line.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy