2

I'm looking for a way to delay the auto response (mail_2) from Contact Form 7 for 2 days. But I have no clue how to tackle it. I hope you have an idea.

I'm using the following code in functions.php

add_action( 'wpcf7_before_send_mail', 'send_custom_respond' );

function send_custom_respond($WPCF7_ContactForm) {

  $submission = WPCF7_Submission::get_instance();
  $posted_data = $submission->get_posted_data();
  $contact_name = $posted_data['your-name'];
  $contact_email = $posted_data['your-email'];

  $mail_2 = $WPCF7_ContactForm->prop('mail_2') ;
  $mail_2['subject'] = "Enjoying the trial?";
  $mail_2['body'] = "Hi ". $contact_name . ",\n how's the trial? Let us know if you need some assistance.";

  $WPCF7_ContactForm->set_properties(array("mail_2" => $mail_2));

  return $WPCF7_ContactForm;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.