Title: help using this filter
Last modified: August 28, 2021

---

# help using this filter

 *  Resolved [voviet1591](https://wordpress.org/support/users/voviet1591/)
 * (@voviet1591)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/help-using-this-filter/)
 * Hello admin mkscripts
    I’m about to create a new “Download”. But the configs 
   don’t allow to set multiple emails. We would really like to send different emails
   for each downloaded items. can you guide me how to use this code:$message = apply_filters(‘
   dae_email_message’, $message, $values, $messages[’email_content’], $file, $download_url);,
   what do i need to do With it, where do I copy this code.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [mkscripts](https://wordpress.org/support/users/mkscripts/)
 * (@mkscripts)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/help-using-this-filter/#post-14825692)
 * Hi,
 * You can read [here](https://developer.wordpress.org/plugins/hooks/filters/) what
   filters are exactly and how to use them in your code. To help you on your way,
   we have made the following example:
 *     ```
       <?php
   
       add_filter( 'dae_email_message', 'my_content_email_message', 10, 5 );
       function my_content_email_message( $message, $values, $email_content, $file, $download_url ) {
   
           if ( 'new.txt' == $file ) {
               $message = '
                   <h1>This is the title</h1>
                   <p>This is a paragraph...you can use a placeholder like this: {email}</p>
                   <p>You can find your Free Download here: <a href="{download_url}">Example-1</a></p>
               ';
           }
   
           if ( 'old.txt' == $file ) {
               $message = '
                   <h1>This is the title</h1>
                   <p>This is a paragraph...</p>
                   <p>You can find your Free Download here: <a href="{download_url}">Example-2</a></p>
               ';
           }
   
           return $message;
   
       }
   
       ?>
       ```
   
 * You can add the code to your theme’s functions.php or to your custom plugin. 
   It is recommended that you always test your code before using it on a live site.
 * Kind regards,
    Team Download After Email
 *  Thread Starter [voviet1591](https://wordpress.org/support/users/voviet1591/)
 * (@voviet1591)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/help-using-this-filter/#post-14826257)
 * thank you very much , may I ask: if ( ‘new.txt’ == $file ) , ‘new.txt’ and ‘old.
   txt’ is it default or can I change it to any value, What is a complete and correct
   code for the example below, thank you
 * > [View post on imgur.com](https://imgur.com/a/fIxpUtp)
    -  This reply was modified 4 years, 9 months ago by [voviet1591](https://wordpress.org/support/users/voviet1591/).
 *  Plugin Author [mkscripts](https://wordpress.org/support/users/mkscripts/)
 * (@mkscripts)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/help-using-this-filter/#post-14841177)
 * You are welcome. To make your code complete/working, you need to replace the 
   example file names (new.txt and old.txt) and adjust the content (HTML code) of
   the messages to your needs.
 * Kind regards,
    Team Download After Email

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘help using this filter’ is closed to new replies.

 * ![](https://ps.w.org/download-after-email/assets/icon-256x256.png?rev=2016027)
 * [Download After Email - Subscribe & Download Form Plugin](https://wordpress.org/plugins/download-after-email/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-after-email/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-after-email/)
 * [Active Topics](https://wordpress.org/support/plugin/download-after-email/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-after-email/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-after-email/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [mkscripts](https://wordpress.org/support/users/mkscripts/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/help-using-this-filter/#post-14841177)
 * Status: resolved