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 integrate Quform and the MyMail Newsletter plugin, by adding subscribers to your mailing list when the form is submitted. The code will be slightly different depending on what fields you want to save, we have added a few different code examples below, choose one that suits your form setup. In each guide you should add the code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

Saving just an email address

1
2
3
456
7
8
9
10
11
function my_quform_mymail_subscribe($form)
{
    if (function_exists('mymail_subscribe')) {
        $email = $form->getValue('iphorm_1_1');        $lists = array('visitors');        $doubleOptIn = false;
 
        mymail_subscribe($email, array(), $lists, $doubleOptIn);
    }
}
add_action('iphorm_post_process_1', 'my_quform_mymail_subscribe');
function my_quform_mymail_subscribe($form)
{
    if (function_exists('mymail_subscribe')) {
        $email = $form->getValue('iphorm_1_1');
        $lists = array('visitors');
        $doubleOptIn = false;

        mymail_subscribe($email, array(), $lists, $doubleOptIn);
    }
}
add_action('iphorm_post_process_1', 'my_quform_mymail_subscribe');
  • On line 4, change iphorm_1_1 to your email element unique ID
  • On line 5, change visitors to the slug of the list you want to add the subscriber to
  • On line 11, change the number 1 to your form ID

Saving the first name, last name and email address

1
2
3
45678
9
10
11
12
13
function my_quform_mymail_subscribe($form)
{
    if (function_exists('mymail_subscribe')) {
        $fname = $form->getValue('iphorm_1_1');        $lname = $form->getValue('iphorm_1_2');        $email = $form->getValue('iphorm_1_3');        $lists = array('visitors');        $doubleOptIn = false;
 
        mymail_subscribe($email, array('firstname' => $fname, 'lastname' => $lname), $lists, $doubleOptIn);
    }
}
add_action('iphorm_post_process_1', 'my_quform_mymail_subscribe');
function my_quform_mymail_subscribe($form)
{
    if (function_exists('mymail_subscribe')) {
        $fname = $form->getValue('iphorm_1_1');
        $lname = $form->getValue('iphorm_1_2');
        $email = $form->getValue('iphorm_1_3');
        $lists = array('visitors');
        $doubleOptIn = false;

        mymail_subscribe($email, array('firstname' => $fname, 'lastname' => $lname), $lists, $doubleOptIn);
    }
}
add_action('iphorm_post_process_1', 'my_quform_mymail_subscribe');
  • On line 4, change iphorm_1_1 to your First Name element unique ID
  • On line 5, change iphorm_1_2 to your Last Name element unique ID
  • On line 6, change iphorm_1_3 to your Email element unique ID
  • On line 7, change visitors to the slug of the list you want to add the subscriber to
  • On line 13, change the number 1 to your form ID
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy