Send Elementor E-Mail Form Attachments as Regular E-Mail Attachments instead of a link that is saved in the ftp server
Prerequisites
WordPress & Elementor Pro
- I have searched for similar features requests in both open and closed tickets and cannot find a duplicate.
- The feature is still missing in the latest stable version of Elementor ( Elementor Pro. )
What problem is your feature request going to solve? Please describe.
Elementor Contact Form email attachments should not go to ftp drive and sent as a link. It is annoying and takes too long to delete.
Describe the solution you’d like
We would suggest Elementor Email Forms should be sent as E-Mail Attachments instead of saving to ftp server as a link. It is very annoying and counter intuitive for us to have to go to the ftp drive to retrieve/delete images a customer sends to us via form attachments. It would be best if either they can be just sent as an “attachment” or a folder you could create in wp-admin > elementor > email attachments. Either way would be better than the system now. But a regular old fashioned email attachment is preferred.
Describe alternatives you’ve considered
Above is all
Additional context
None
<?php /** * Class Elementor_Form_Email_Attachments * * Send Elementor Form upload field as attachments to email */ class Elementor_Form_Email_Attachments { public $attachments_array = []; public function __construct() { add_action( 'elementor_pro/forms/process', [ $this, 'init_form_email_attachments' ], 11, 2 ); } /** * @param \ElementorPro\Modules\Forms\Classes\Form_Record $record * @param \ElementorPro\Modules\Forms\Classes\Ajax_Handler $ajax_handler */ public function init_form_email_attachments( $record, $ajax_handler ) { // check if we have attachments $files = $record->get( 'files' ); if ( empty( $files ) ) { return; } // Store attachment in local var foreach ( $files as $id => $files_array ) { $this->attachments_array[] = $files_array['path'][0]; } // if local var has attachments setup filter hook if ( 0 < count( $this->attachments_array ) ) { add_filter( 'wp_mail', [ $this, 'wp_mail' ] ); add_action( 'elementor_pro/forms/new_record', [ $this, 'remove_wp_mail_filter' ], 5 ); } } public function remove_wp_mail_filter() { $this->attachments_array = []; remove_filter( 'wp_mail', [ $this, 'wp_mail' ] ); } public function wp_mail( $args ) { $args['attachments'] = $this->attachments_array; return $args; } } new Elementor_Form_Email_Attachments();
Reference: https://github.com/elementor/elementor/issues/4868