2

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

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?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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