i am not sure if i am doing something wrong, but i think the token replacement when sending by cron doesn't work, it only works when sending a test mail.

Comments

luksak’s picture

i fixed this issue by adapting the method the realname module is using to modify the mail's "To:" header:

<?php
function my_module_mail_alter(&$message) {
  if (strpos($message['id'], 'simplenews') !== FALSE) {
    $user = user_load(array('mail' => $message['to']));
    profile_load_profile($account);
    // Replace receiver's name.
    $var = array ('[!simplenews-receiver-salutation!]' => $user -> profile_salutation, '[!realname!]' => $user -> realname);
	$message['body']['body'] = strtr($message['body']['body'], $var);
  }
}
?>

the problem is that when this hook gets called, the token replacement has already taken place. it would also be nice if we could integrate the profile module here.

any ideas how to improve this?

lukas

funana’s picture

Token replacement does not work, confirmed. Tried both, the old !token and the [new] token.

sgabe’s picture

Title: token replacement » Token replacement doesn't work
Status: Active » Postponed (maintainer needs more info)

I have just tested the 2.x branch and couldn't reproduce this. It seems to work just fine. Please provide more details on how to reproduce this.

rmcom’s picture

Status: Postponed (maintainer needs more info) » Active

The 6.2 dev version works, but not the released 6.1 version.

Would it be possible to release the current 6.x-2.x-dev version with some of the other updated and issue solution in it?

sgabe’s picture

Yeah it is on my todo list, but I am extra busy these days. I need to do a thorough review then the 2.x branch will be the recommended branch.

roball’s picture

Version: 6.x-2.x-dev » 6.x-2.0-alpha1
Status: Active » Fixed

I can confirm that the [simplenews-receiver-realname] token just works fine with 6.x-2.0-alpha1, in both the test mail and real newsletter mailings.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.