I'm using Drupal 7 Privatemsg module. To prefill the message body, I use the following hook but don't get anything displayed.

function MyModule_privatemsg_message_view_alter(&$vars) {

  $vars['message']['body'] = "<i>Dear Friend</i>,\n <strong>you rock!</strong>";

Any help ?

1 Answer 1


One solution is to use the Prepopulate module and then customize the URL to send a privatemsg. This works well if you are using Views to generate the links, for example.

  • I tried to use the URL but /message/new returns Access Denied even for admin
    – postgres83
    Feb 17, 2016 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.