fluentform_filter_email_attachments

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

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

wp-content/plugins/fluentform/app/Services/FormBuilder/Notifications/EmailNotification.php

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *