I am writing a module in Drupal-7 that dynamically sends a one-time link to enter guests. Everything works fine until I add a reference to the array $messagewhen it suffocates. If I do dpm($message), the link appears in the array $message['body'], as expected. If I comment out a line using a function url(), everything will work as it should. Why are php / Drupal choking on this dumb link?
function rsvp_mail($key, &$message, $params) {
switch($key) {
case "send invite" :
$timestamp = REQUEST_TIME;
$account = $params['account'];
$message['subject'] = "And invitation for $account->name";
$message['body'][] = 'Some body text.';
$message['body'][] = 'Some more text!';
$message['body'][] = url( 'http://wedding.juicywatermelon.com/rsvp/' . $account->uid . "/" . $timestamp . "/" . md5($account->pass . $timestamp) . "/" . 'user/' . $account->uid . '/edit/Wedding');
break;
}
}
ps - I had code to generate the link in a separate function call and for brevity translated it into a hook implementation. This, however, did not affect behavior.
and the code that generates the email:
function rsvp_mail_send($account) {
$module = 'rsvp';
$from = "email@gmail.com";
$key = "send invite";
$params['account'] = $account;
$to = $account->mail;
$language = language_default();
$send = TRUE;
$result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
}
source
share