• Hi everyone,

    I’m trying to trigger a function when a Contact Form 7 submission is successfully sent. However, the wpcf7_mail_sent action does not seem to fire.

    Here’s a simplified version of my code in functions.php:

    add_action('wpcf7_mail_sent', 'my_custom_function', 10, 1);
    function my_custom_function($contact_form) {
    error_log("wpcf7_mail_sent triggered for form ID: " . $contact_form->id());
    }

    <span style=”font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>I expected this to write a log entry in </span><code data-start=”620″ data-end=”642″>wp-content/debug.log<span style=”font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>, but nothing appears.</span>

    • Is <code data-start=”672″ data-end=”689″>wpcf7_mail_sent still a valid hook in the latest version of Contact Form 7?
    • If not, what is the recommended alternative for running custom PHP after a form is successfully sent?

    Thanks in advance!

  • You must be logged in to reply to this topic.