How to add autorespond mail in contact form 7

Contact Form 7 is a popular WordPress plugin for creating contact forms. To add an autorespond email in Contact Form 7, you can follow these steps:

Method 1: Using the "Additional Settings" field

  1. Go to your WordPress dashboard and navigate to the page where you have installed Contact Form 7.
  2. Click on the "Edit" button next to the form you want to add an autorespond email to.
  3. Scroll down to the "Additional Settings" field and click on the "Edit" button.
  4. In the "Additional Settings" field, add the following code:
    on_sent_ok: "wp_mail('[email protected]', 'Subject', 'Autorespond message');"

    Replace [email protected] with the email address you want to receive the autorespond email, Subject with the subject of the email, and Autorespond message with the message you want to send.

For example:

on_sent_ok: "wp_mail('[email protected]', 'Autorespond: Thank you for contacting us!', 'Thank you for contacting us. We will get back to you soon.');"
  1. Click "Save" to save the changes.

Method 2: Using a plugin

There are several plugins available that can help you add an autorespond email in Contact Form 7. One popular plugin is "Contact Form 7 Autoresponder".

  1. Install and activate the "Contact Form 7 Autoresponder" plugin.
  2. Go to the plugin's settings page and configure the autorespond email settings.
  3. In the "Contact Form 7" settings page, click on the "Autoresponder" tab.
  4. Select the form you want to add an autorespond email to and configure the autorespond email settings.
  5. Click "Save" to save the changes.

Method 3: Using a custom function

If you are comfortable with coding, you can also add an autorespond email using a custom function.

  1. Create a new file in your WordPress theme's functions.php file and add the following code:

    function autorespond_email($form_id) {
     $form = wpcf7_get_form_by_id($form_id);
     $submission = WPCF7_Submission::get_instance();
     $form_data = $submission->get_posted_data();
     $email = $form_data['your-email-field'];
     $subject = 'Autorespond: Thank you for contacting us!';
     $message = 'Thank you for contacting us. We will get back to you soon.';
     wp_mail($email, $subject, $message);
    }
    add_action('wpcf7_mail_sent', 'autorespond_email');

    Replace your-email-field with the name of the email field in your contact form.

  2. Save the changes and go to the Contact Form 7 settings page.

  3. Click on the "Mail" tab and select the form you want to add an autorespond email to.

  4. Click "Save" to save the changes.

That's it! With these methods, you should be able to add an autorespond email in Contact Form 7.