Example #1
0
/**
 * Replace the template variables in a given text.
 */
function mailusers_replace_sender_templates($text, $sender_name)
{
    $text = preg_replace('/%FROM_NAME%/', mailusers_preg_quote($sender_name), $text);
    return $text;
}
            $mail_content = wpautop(mailusers_replace_post_templates($mail_content, $post_title, $post_author, $post_excerpt, $post_content, $post_url));
        } else {
            $mail_content = mailusers_replace_post_templates($mail_content, $post_title, $post_author, $post_excerpt, $post_content, $post_url);
        }
    }
} else {
    if (!isset($subject)) {
        $subject = mailusers_get_default_subject();
    }
    if (!isset($mail_content)) {
        $mail_content = mailusers_get_default_body();
    }
}
//  Override the send from address?
if ($from_sender == 1 && !empty($override_address) && is_email($override_address)) {
    $mail_content = preg_replace('/' . $from_name . '/', mailusers_preg_quote($override_name), $mail_content);
    $from_address = $override_address;
    if (!empty($override_name)) {
        $from_name = $override_name;
    }
}
// If error, we simply show the form again
if (array_key_exists('send', $_POST) && $_POST['send'] == 'true' && $err_msg == '') {
    // No error, send the mail
    ?>

	<div class="wrap">
	<?php 
    // Fetch users
    // --
    $recipients = array();