• Hi guys,

    I’ve been trying to attach files dynamically without any success. Here’s what I’ve tried:

    add_action('wpcf7_before_send_mail','send_pdf');
    function send_pdf( $cf7 ) {
            $submission = WPCF7_Submission::get_instance();
            $submission->add_uploaded_file('pdf', '../path/to/uploads/test.pdf');
    }

    I’ve also tried:

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components1', 10, 2 );
    function mycustom_wpcf7_mail_components1( $components, $form ) {
            $components['attachments'] = array("../path/to/uploads/test.pdf");
            return $components;
    }

    Any ideas? Thanks!

    https://ww.wp.xz.cn/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Can't attach file dynamically’ is closed to new replies.