Title: Multiple dynamical attachments files
Last modified: August 22, 2016

---

# Multiple dynamical attachments files

 *  [attimo](https://wordpress.org/support/users/attimo/)
 * (@attimo)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/multiple-dynamical-attachments-files/)
 * 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://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

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

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [mail](https://wordpress.org/support/topic-tag/mail/)

 * 0 replies
 * 1 participant
 * Last reply from: [attimo](https://wordpress.org/support/users/attimo/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/multiple-dynamical-attachments-files/)
 * Status: not resolved