1. The 3.8 code for Fabrik is now available on github, in the 'master' branch. If you are familiar with updating Fabrik from github, we would appreciate it if you could test this code on J! 3.8 for us. Once we have some feedback, we'll build a 3.8 release.

Email scheduled task

May 26, 2015
Email scheduled task

  • Introduction(top)


    The email plugin will iterate over each record in the list defined in the plugin's general connection/list options, and send an email out per record. This can be useful for notifying users.

    The Email scheduled task plugin will only run if the Fabrik Cron System Plug-in is installed.

    Options - details(top)


    cron-email-options.png

    • To - Email address to send the notification to - can use the table's record's data by using placeholders e.g. {tablename___elementname}
    • Subject - The email subject - can use the table's record's data by using placeholders e.g. {tablename___elementname}
    • Message - The email subject - can use the table's record's data by using placeholders e.g. {tablename___elementname}
    • Eval- Evaluate the Message as PHP code
    • Condition - OPTIONAL PHP to evaluate for each row. The row will not be processed if you return false. Standard element placeholders can be used, or row data can be accessed from $row array. Remember that this code runs on every row in the list, so keep your code efficient so you don't run in to max execution time issues.

    Options - Update (top)


    cron-email-update.png
    • Field - select a table's field to update
    • Value - select the value to update to
    • Eval - should we evaluate the update value.
    Update works well in conjunction with a prefilter on the selected list. For example your list may have a prefilter:


    where sent = 0


    In your update field you could select 'sent' and set the value to '1'.


    This would mean that the row is only processed once by the plug-in

    PHP Examples(top)

    Removing apostrophes from fields for proper html output. This will replace apostrophes of both types, straight and curled from the fields and replace them with encoded values, preventing any errors like "Message Body Empty" when attempting to run the email cron. Reminder: you need to turn Eval on for PHP code to work in the Message textarea.

    PHP:

    //removing apostrophe from fields...
    $personname = "{pfx_listname___name_raw}";
    $personname = preg_replace("/'/", "'", $personname);
    $personname = preg_replace("/’/", "'", $personname);
     
    //assign $output variable the email body html
    $output = '<p>The new subscriber '.$personname.' sent you a message, login to view it.</p>';
     
    //send $output back to Fabrik
    return $output;
     
  • Loading...