• Resolved voviet1591

    (@voviet1591)


    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

    (@mkscripts)

    Hi,

    You can read here 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

    (@voviet1591)

    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
    https://imgur.com/a/fIxpUtp

    • This reply was modified 4 months, 3 weeks ago by voviet1591.
    Plugin Author mkscripts

    (@mkscripts)

    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)
  • You must be logged in to reply to this topic.