• Hi,

    Im trying to automatically send a file whenever someone fills the form and I came with this code from the creator of the plugin:

    add_filter( ‘wpcf7_mail_components’, ‘mycustom_wpcf7_mail_components’ );

    function mycustom_wpcf7_mail_components( $components ) {
    $components[‘attachments’][] = ‘wp-content/uploads/2012/11/Glosario-abierto-.pdf”;
    return $components;
    }

    It doesn’t work, though, with Contact Form 7 latest build. I get this error message:

    add_filter( ‘wpcf7_mail_components’, ‘mycustom_wpcf7_mail_components’ ); function mycustom_wpcf7_mail_components( $components ) { $components[‘attachments’][] = ‘https://www.website.com/files/testni.pdf’; return $components; }
    Warning: Cannot modify header information – headers already sent by (output started at /home/expandir/public_html/wp-content/themes/ChildThemeTwentyEleven/functions.php:6) in /home/expandir/public_html/wp-includes/pluggable.php on line 881

    What im doing wrong?

    Thanks!!

  • The topic ‘Contact Form 7 add new attachment solution provided doesnt work’ is closed to new replies.