The code below adds variables replacement feature to emails sent using Mailout. The code comes from the simplenews module. The variable %name (subscriber's name) was added.

    // Replace variables (code from simplenews_replace_vars)
    global $base_url;
    $variables = array(
        '%site' => variable_get('site_name', 'drupal'), 
        '%uri' => $base_url, 
        '%uri_brief' => drupal_substr($base_url, drupal_strlen('http://')), 
        '%name' => $data['name'], 
        '%email' => $data['email_to'], 
        '%date' => format_date(time()), 
        '%login_uri' => url('user/login', NULL, NULL, TRUE),
    );
    $final_email_body = strtr($final_email_body, $variables);
    $final_plain = strtr($final_plain, $variables);

This code is to be inserted in mailout_send.inc line 597 right after:

    $final_plain = $data['email_plain'];

Comments

AlenaSystems’s picture

Status: Active » Needs review
sime’s picture

Version: 5.x-1.0-rc2 » 6.x-1.x-dev
Status: Needs review » Closed (duplicate)

Thanks Alena!
I've added a link back to these suggestions from another issue:
http://drupal.org/node/262836