| 1 |
<?php |
<?php |
| 2 |
// $Id: regcode_mailer.module,v 1.1.2.2 2009/10/01 21:39:23 aidan Exp $ |
// $Id: regcode_mailer.module,v 1.1.2.3 2009/10/05 21:58:47 aidan Exp $ |
| 3 |
|
|
| 4 |
|
|
| 5 |
/** |
/** |
| 150 |
function regcode_mailer_regcode_action_gotomail() { |
function regcode_mailer_regcode_action_gotomail() { |
| 151 |
drupal_goto('admin/user/regcodes/mail'); |
drupal_goto('admin/user/regcodes/mail'); |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
/** |
| 156 |
|
* Implements hook_mail() |
| 157 |
|
*/ |
| 158 |
|
function regcode_mailer_mail($key, &$message, $params) { |
| 159 |
|
switch($key) { |
| 160 |
|
case 'regcode_mail': |
| 161 |
|
$message['subject'] = $params['subject']; |
| 162 |
|
$body = $params['message']; |
| 163 |
|
foreach ($params['tokens'] as $key => $value) { |
| 164 |
|
$body = str_replace("%{$key}%", $value, $body) ; |
| 165 |
|
} |
| 166 |
|
$message['body'][] = $body; |
| 167 |
|
break; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
return $message; |
| 171 |
|
} |