Add Contact Form 7 AutoResponder Functions

Contact Form 7 is one of the most popular contact form plugins for WordPress website users and over 5+ million active users. So, You can make any kind of form using the Contact Form 7 plugin. No chance, Contact Form 7 is the most popular plugin and very easy to use WordPress contact form plugin. In today’s post, I’m going to share a serious of tips that How to add Contact Form 7 AutoResponder Functions.

Add Contact Form 7 AutoResponder using PHP functions. Add the following code in your active me fucntions.php file.

/**
 * Following code add theme functions.php file. 
 *
 */
add_action( 'wpcf7_mail_sent', 'contact_form_autoresponders' ); 
function contact_form_autoresponders( $contact_form ) {
// replace with ID 
if( $contact_form->id==1234 ){
 
//retrieve the details of the form/post
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
 
switch( $posted_data['location'] ){ 
case 'California':
$msg="California email body goes here";
break;
 
case 'Texas':
$msg="Texas email body goes here";
break;
 
}
mail( $posted_data['your-email'], 'Thanks for your enquiry', $msg );
   }
 
}

You may need to change just some of the text of the function like $contact_form_id==1234 replace ID with your created ID. Look at the PHP switch functions and replace them with your business or personal locations. After, complete save the functions.php file.

You can use a Contact Form 7 Auto Responder Addon is a plugin for your WordPress website. But this addon is premium. so, I would like to suggest you the above code for your website.

You might also like to add Contact Form 7 AutoResponder Functions without any coding or any plugin. I have a great solution for you. So, let’s see what is a piece of good news.

Login your website admin panel finds the contact menu in the admin panel on the left side. Open a content form and click the mail tab and Mail (2) (Use Mail (2)) checkbox.

After complete, your AutoResponder Function would be active so, you should change a few settings e.g your-mail, subjects, message body, etc. (if needed ). See the following image.

How to add Contact Form 7 AutoResponder Functions Step by Step Guide

I hope this tutorial would be very helpful for adding Contact Form 7 AutoResponder Functions. If you have any questions or do you need any help, please feel free to comment.

Wrap Up

Any website contact page is the most important for the website owner. So, the contact form is the same important for the website owner.

You may use any kind of contact form for your website because there is plenty of contact form plugins available.

But if you use the contact form 7 plugin for the website, this article would be important for you.

Check Out My Fiverr Profile. To Fix WordPress Or WooCommerce any kinds of issues or errors: Fix WordPress WooCommerce Issues Or Errors.

Topics