By using Elementorforum.com’s services you agree to our Cookies Use and Data Transfer outside the EU.
We and our partners operate globally and use cookies, including for analytics, personalisation, ads and Newsletters.

  • Join the Best Wordpress and Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!
elementor official

Elementor Forms: Send second mail if

U

u937465

New Member
Hi there,
i need some help with elementor forms.
my form contains one checkbox [field id="requestDemo"]

Only if the checkbox is ticked a mail should be send.

Form name: RequestDemo
mail to send: Email 2

Is there a code snippet i could add to my functions.php that would help?
Pls a nerdy answer ;)
 
Community

Community

Administrator
Staff member
I have no idea if this would work, but you could maybe test it accordinly and adjust it :

PHP:
 function handle_request_demo_form_submission(){if ( isset( $_POST['requestDemo'] ) && $_POST['requestDemo'] == 'yes' ){// Send the email using WordPress's wp_mail function
    $to = 'Email 2';
    $subject = 'Request Demo Form Submission';
    $body = 'A user has submitted the Request Demo form on your site.';
    wp_mail( $to, $subject, $body );
  }
}
add_action( 'elementor_pro/forms/handle_form_submission/RequestDemo', 'handle_request_demo_form_submission' );

This code checks if the requestDemo field was submitted with a value of yes (indicating that the checkbox was checked),and if so, sends an email to the specified address.

You can customize this code to suit your needs, such as changing the email subject and body or adding additional fields from the form to the email.
 

Latest Resources

Other Elementor Resources

elementor official
Top