In Drupal 7.10 I have the /contact form open to anyone and would liketo add the Reply-To header to the mail message.

How do I get the value of the e-mail address field in the /contact form - both for guests and registered users?

Here is what I'm trying:

function your_module_mail_alter(&$message) {
  if ( $message['id'] == 'contact_page_mail' ) {
     $message['headers']['Reply-to'] = YYY;

1 Answer 1


Try doing this in hook_form_alter() instead of hook_mail_alter(). You can likely then run your own parameters into drupal_mail().

I would recommend not using this contact form, though, since it's terribly limited in terms of functionality. Why not use a Webform at /contact where you can specify all of these settings and do potentially cooler things too, like pre-filling fields for logged in users?

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.