Description #
This filter gives the option to add your own attachment with the email. It is called before sending an email notification.
Usage #
Here is an example:
add_filter('fluentform/filter_email_attachments', function($emailAttachments, $notification,$form, $submittedData){
$target_form_id = 29;
if($form->id != $target_form_id){
return;
}
$media_id = 144;
$emailAttachments[] = get_attached_file($media_id);
//or pass the exact file location like this
//$emailAttachments[] = '/doc/wp/wp-content/uploads/%c3%a4-%c3%bc%c3%9f-etc_531_171.pdf';
return $emailAttachments;
}, 10, 4);
Parameters #
- $emailAttachments (Array) Attachments
- $notification (Array) Notification settings data
- $submittedData (Array) Submitted form data
- $form (Object) The $form Object
Placement #
This code should be placed in the functions.php file of your active theme. You can also use snippet plugins to add functions if you do not want to modify the function.php file.
Source Code #
This filter is located in FluentForm\app\Services\FormBuilder\Notifications\EmailNotifications -> notify($notification, $submittedData, $form, $entryId = false)