Support » Plugin: Contact Form 7 » wpcf7_before_send_mail does not work for me

  • I have a contact form and I want to create a database entry at the same time the contact form emal gets sent. Too try it out I have created a testfunction which looks like this:

    function testfunc( $cf7 )
    mysql_connect("localhost", "user_name", "password") or die(mysql_error());
    mysql_select_db("database_name") or die(mysql_error());
    mysql_query("CREATE TABLE aaaaaaaaaaa ( test VARCHAR(30))") or die(mysql_error());

    This function should only test if the database is editable.

    I also inserted the line add_action( 'wpcf7_before_send_mail', 'testfunc', 1); to run the testfunction.

    The only problem is, that it is not working. When I run the function in a seperate php-file it all works out but within the plugin nothing happends.

  • The topic ‘wpcf7_before_send_mail does not work for me’ is closed to new replies.