Title: VCF as attachment
Last modified: May 26, 2023

---

# VCF as attachment

 *  Resolved [antoinelrx](https://wordpress.org/support/users/antoinelrx/)
 * (@antoinelrx)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/vcf-as-attachment/)
 * Hi, 
   I created this function to add a vcf to an email. It works if I try with
   a png file. But it is not working with vcf and I can’t figure out why. Do you
   have any idea ? I’m 100% sure the file is in the folder, I can access it with
   other functions.
 *     ```wp-block-code
       add_filter('acfe/form/submit/email_args/action=mail-prospect', 'user_vcf', 10, 3);
       function user_vcf($args, $form, $action) {
           $ecard_id = get_the_ID();
           $random_slug = get_field('random_slug', $ecard_id);
   
           $sourceFilePath = trailingslashit(ABSPATH) . '/f/contact/' . $random_slug . '/' . $random_slug . '.vcf';
           $destinationFilePath = trailingslashit(ABSPATH) . '/f/prospects/' . $random_slug . '.vcf';
   
           // Copy the file
           if (copy($sourceFilePath, $destinationFilePath)) {
   
               //WORKS $args['attachments'] = array(trailingslashit(ABSPATH) . '/f/prospects/logo-ecard.png'); 
               //DO NOT WORK $args['attachments'] = array(trailingslashit(ABSPATH) . '/f/prospects/cmdjqi.vcf'); 
               $args['attachments'] = array($destinationFilePath);
   
              //WORKS unlink($destinationFilePath);
           }
   
           return $args;
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/vcf-as-attachment/#post-17153923)
 * Hello,
 * Thanks for the feedback!
 * Any kind of file type can be attached to an email, as long as it is permitted
   by [wp_mail()](https://developer.wordpress.org/reference/functions/wp_mail/) (
   which is the function used by ACFE behind the scene to send emails).
 * I would recommend to double check your code, and log data using `acf_log()` to
   make sure everything is in order during the form submission.
 * You’ll find an extended [guide on how to debug WP/ACFE here](https://www.acf-extended.com/guides/debugging-wordpress-acf)
   if needed.
 * Hope it helps!
 * Regards.

Viewing 1 replies (of 1 total)

The topic ‘VCF as attachment’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/vcf-as-attachment/#post-17153923)
 * Status: resolved