Drupal eMail: Fixing from and reply-to information
Slight hack of contact.pages.inc file so that if a users submits a contact form through your site, when you receive the email and click "reply" you'll reply to the email value entered on the form, not the server that sent the email.
Note: in some providers, like gmail you need to make sure that the from email set in contact, is not the same as the email that contact forms get sent to. This is something that gmail sets as it's getting routed through smtp.gmail.com
Contact Form Fix For Drupal 6 (From and Reply-To Formation)
Chad_Dupuis - May 17, 2009 - 04:03
In drupal 6 you can use hook_mail_alter to change the information within a particular module (or globally if you build your own module) to correct this issue. My code for d6 to correct mails from the contact module is as follows (add the following to the end of contact.pages.inc)
+ +function contact_mail_alter(&$message) { + $properfrom = variable_get('site_mail',''); + $properreplyto = $message['from']; + $message['headers']['From'] = $properfrom; + $message['headers']['Reply-To'] = $properreplyto; +}
- admin's blog
- Login to post comments