Hmm, I figured in my case there was something wrong with the php, mysqli_connect() stops the function, probably giving an error, but I don’t know how to catch. It’s just peculiar that it would stop working after an update.
add_action( 'wpcf7_mail_sent', 'cf7_beforesend' );
I used your code and added this aswell, so that it would run, but the submit button just keeps spinning and it doesn’t give me any success message. The email is sent though, this happened after an update, anyone that might know the issue?
I have a problem with the same thing, mine stopped working after update. The function runs, but it won’t submit the data.