• Hi,
    how I can attach multiple files create dynamically before email is sent by form? I can’t use the field on email template in admin dashboard cause names of files always change.

    Here’s the code of my function:

    function my_wpcf7_function($cfdata) {
    
    	$submission = WPCF7_Submission::get_instance();
    	if ( $submission ) {
    		$posted_data = $submission->get_posted_data();
    
    		$mail = $cfdata->prop('mail');
    
                    $mypath1 = full path file create dynamically
                    $mypath2 = full path file create dynamically
                    $mypath3 = full path file create dynamically
    
    		$mail['attachments'] = ''.$mypath1.'\n'.$mypath2.'\n'.$mypath3.';
    
    		$cfdata->set_properties(array('mail' => $mail));
    
    	}
    
    }
    add_action('wpcf7_before_send_mail', 'my_wpcf7_function', 1);

    Thank you for any helps.

    https://www.ads-software.com/plugins/contact-form-7/

  • The topic ‘Multiple dynamical attachments files’ is closed to new replies.