Pages

Sunday, September 29, 2019

How to add Contact Form 7 AutoResponder Functions

Contact Form 7 is the most popular and easy to use contact form WordPress plugin. Contact Form 7 Active installations: 5+ million and Version:5.1.4 available in the WordPress Plugin Directory. Contact Form 7 can manage multiple contact forms.  There may be an issue for some users that want to activate the autoreply or autoresponder e-mail that will be sent to the customer as a notification about receiving the sent query through the mail form, but the sender’s name may appear as WordPress.The settings allow to use this second e-mail, but the sender’s name has to be entered in a specific way if you’d like to have your desired name as the sender’s name in the recipient’s inbox.

You can add two-way AutoResponder:

One:

  • In settings go to Contact -> Contact Forms -> Mail tab.
  • Scroll down to the section where you can add a tick to Use Mail (2), tick it and new settings form appears.
  • See the row From and insert your senders' name and e-mail in the appropriate format.

Learn More here Contact Form 7 Docs and FAQ.
Two:
/**
 * 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 );
   }

}
If you want then you can use free Contact Form 7 AutoResponder Addon plugin OR premium plugin CF7 AutoResponder Addon.But you should check carefully everything before installing the plugin. Still, form not working or if you have any questions.
Check out my Fiverr Profile and I can fix WordPress Or WooCommerce any kinds of issues: Fix WordPress WooCommerce Issues Or Errors.

No comments:

Post a Comment